Skip to content

Instantly share code, notes, and snippets.

@wvdk
Created April 27, 2017 00:16
Show Gist options
  • Save wvdk/6d4478d1d975068a011eb0bc7d3c5c6f to your computer and use it in GitHub Desktop.
Save wvdk/6d4478d1d975068a011eb0bc7d3c5c6f to your computer and use it in GitHub Desktop.
Get the version number from info plist and return nicely formatted
var prettyVersionNumber: String {
get {
if let infoDictionary = Bundle.main.infoDictionary {
if let versionNumber = infoDictionary["CFBundleShortVersionString"] as? String,
let buildNumber = infoDictionary["CFBundleVersion"] as? String {
return "\(versionNumber) (\(buildNumber))"
}
}
return "No version number found."
}
}
@wvdk
Copy link
Author

wvdk commented Aug 15, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment