Skip to content

Instantly share code, notes, and snippets.

@hishma
Created January 16, 2019 23:59
Show Gist options
  • Save hishma/130dd0eeaf5d6aa52137b6ff9e62a0b9 to your computer and use it in GitHub Desktop.
Save hishma/130dd0eeaf5d6aa52137b6ff9e62a0b9 to your computer and use it in GitHub Desktop.
Provides convenience accesors to some info dictionary keys
/// Provides convenience accesors to some info dictionary keys
extension Bundle {
var identifier: String? {
return string(forInfoDictionaryKey: "CFBundleIdentifier")
}
var displayName: String? {
return string(forInfoDictionaryKey: "CFBundleDisplayName")
}
var shortVersionString: String? {
return string(forInfoDictionaryKey: "CFBundleShortVersionString")
}
var version: String? {
return string(forInfoDictionaryKey: "CFBundleVersion")
}
func string(forInfoDictionaryKey key: String) -> String? {
return object(forInfoDictionaryKey: key) as? String
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment