Skip to content

Instantly share code, notes, and snippets.

@sayler8182
Created November 13, 2020 15:09
Show Gist options
  • Save sayler8182/a96ec7f9622cea05c78f18491170f92e to your computer and use it in GitHub Desktop.
Save sayler8182/a96ec7f9622cea05c78f18491170f92e to your computer and use it in GitHub Desktop.
// MARK: Bundle
public extension Bundle {
var appVersion: String {
return self.info(for: "CFBundleShortVersionString", or: "0.0.0")
}
var bundleId: String {
return self.info(for: "CFBundleIdentifier")
}
func info(for key: String,
or default: String = "") -> String! {
let value: String? = self.object(forInfoDictionaryKey: key) as? String
return value ?? ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment