Created
July 24, 2020 15:32
-
-
Save DanielCardonaRojas/b3de5a9f020ea7e01716a6d45841be3d to your computer and use it in GitHub Desktop.
UIApplication extensions. Bundle marketing and build versions
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 { | |
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