Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DanielCardonaRojas/b3de5a9f020ea7e01716a6d45841be3d to your computer and use it in GitHub Desktop.
Save DanielCardonaRojas/b3de5a9f020ea7e01716a6d45841be3d to your computer and use it in GitHub Desktop.
UIApplication extensions. Bundle marketing and build versions
extension UIApplication {
static var appVersion: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
}
static var buildVersion: String? {
return Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
}
static var fullVersion: String? {
guard
let marketingVersion = appVersion,
let buildNumber = buildVersion else {
return nil
}
return "\(marketingVersion)(\(buildNumber))"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment