Created
March 10, 2017 08:15
-
-
Save viccc/36813311560d3ec92c7455584a6d9c5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NSBundle { | |
static func appDisplayName(context: NSFormattingContext) -> String { | |
if let str = NSBundle.mainBundle().localizedInfoDictionary?["CFBundleDisplayName"] as? String { | |
return str | |
} | |
if let str = NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleDisplayName") as? String { | |
return str | |
} | |
if let str = NSBundle.mainBundle().infoDictionary?["CFBundleName"] as? String { | |
return str | |
} | |
switch context { | |
case .BeginningOfSentence: | |
return "The app" | |
case .MiddleOfSentence, .Unknown: | |
return "the app" | |
case .Standalone, .ListItem: | |
return "The App" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment