Jorgen Jorgen - 4 months ago 42
Swift Question

Several targets in Xcode

I'm starting a project where I will have several targets.
My question is how do I get an value from the right info.plist?

Say I have three plists...

Target1-info.plist / Target2-info.plist / Target3-info.plist

Is there any 'wildcard' that can be used when using...

if let path = NSBundle.mainBundle().pathForResource("*-info", ofType: "plist")


You can access the values of the plist directly by using NSBundle.mainBundle().objectForInfoDictionaryKey("SOME_KEY")
Just replace "SOME_KEY" with the key you want.

e.g: NSBundle.mainBundle().objectForInfoDictionaryKey("CFBundleDevelopmentRegion")