Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save danionescu/2b0cb7aab3e49a26ddb13cfedb132362 to your computer and use it in GitHub Desktop.
Save danionescu/2b0cb7aab3e49a26ddb13cfedb132362 to your computer and use it in GitHub Desktop.
UIApplication extension to get app version / build
extension UIApplication {
class func appVersion() -> String {
return NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleShortVersionString") as! String
}
class func appBuild() -> String {
return NSBundle.mainBundle().objectForInfoDictionaryKey(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