I would like to be able to get the current version of my iOS project/app as an NSString object without having to define a constant in a file somewhere. I don\'t
NSString
Here's what worked on Xcode 8, Swift 3:
let gAppVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") ?? "0" let gAppBuild = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") ?? "0" print("Version: \(gAppVersion)") print("Build: \(gAppBuild)")