How do I get the name of the target that is currently running in Xcode?
Swift 3.0 Solution.
func getTargetName() -> String {
return Bundle.main.infoDictionary?["CFBundleName"] as! String
}
How about adding ${TARGET_NAME}
in your info.plist?
And I guess you already know how to get it
Obj-C
[[NSBundle mainBundle] objectForInfoDictionaryKey:key_name];
Swift
let targetName = NSBundle.mainBundle().infoDictionary?[key_name] as String