I am attempting to gain access to the main NSBundle
to retrieve version and build information. Thing is, I want to try it in Swift, I know how to retrieve it in Objective-C with:
text = [NSBundle.mainBundle.infoDictionary objectForKey:@"CFBundleVersion"];
Yet I don't know where to start with Swift, I have attempted to write it in the new syntax with no avail.
What was wrong with the Swift syntax? This seems to work:
if let text = Bundle.main.infoDictionary?["CFBundleVersion"] as? String {
print(text)
}