Forked from ashleymills/UIApplication+AppVersion.swift
          
        
    
          Created
          October 30, 2019 13:15 
        
      - 
      
- 
        Save verebes1/5045d79e1ae55aeb261c8cf5f83caefc to your computer and use it in GitHub Desktop. 
    UIApplication extension to get app version / build
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | extension UIApplication { | |
| class func appVersion() -> String { | |
| return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String | |
| } | |
| class func appBuild() -> String { | |
| return Bundle.main.object(forInfoDictionaryKey: kCFBundleVersionKey as String) as! String | |
| } | |
| class func versionBuild() -> String { | |
| let version = appVersion(), build = appBuild() | |
| return version == build ? "v\(version)" : "v\(version)(\(build))" | |
| } | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment