Apple/Swift/Snippets/BuildNumber

Un article de Agora2ia.


       let appInfo = NSBundle.mainBundle().infoDictionary as Dictionary<String,AnyObject>
       let shortVersionString = appInfo["CFBundleShortVersionString"] as String
       let bundleVersion      = appInfo["CFBundleVersion"] as String
       versionLabel.text = "\(shortVersionString).\(bundleVersion)"
       println(">>> App Version: \(versionLabel.text!)")