Created
July 7, 2015 09:40
-
-
Save ariok/2b64150f2fef1ee73df8 to your computer and use it in GitHub Desktop.
[swift] Extend NSBundle to get Version and Build info
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 NSBundle { | |
class var versionNumber: String { | |
if let version = NSBundle.mainBundle().infoDictionary?["CFBundleShortVersionString"] as? String { | |
return version | |
} | |
return "N.D." | |
} | |
class var buildNumber: String { | |
if let build = NSBundle.mainBundle().infoDictionary?["CFBundleVersion"] as? String { | |
return build | |
} | |
return "N.D." | |
} | |
class var versionAndBuild: String{ | |
return "\(NSBundle.versionNumber)-\(NSBundle.buildNumber)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment