Created
March 13, 2015 22:06
-
-
Save cwagdev/0b6725c020d63900fc2f to your computer and use it in GitHub Desktop.
UIApplication Extension for Version and App Name
This file contains 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 var versionString: String { | |
get { | |
if let bundleInfoDictionary = NSBundle.mainBundle().infoDictionary { | |
let buildVersionString = bundleInfoDictionary["CFBundleVersion"] as String | |
let marketingVersionString = bundleInfoDictionary["CFBundleShortVersionString"] as String | |
return marketingVersionString + " (\(buildVersionString))" | |
} else { | |
return "Unknown" | |
} | |
} | |
} | |
class var appName: String { | |
get { | |
if let bundleInfoDictionary = NSBundle.mainBundle().infoDictionary { | |
let name = bundleInfoDictionary["CFBundleDisplayName"] as String | |
return name | |
} else { | |
return "Unknown" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment