shiody_
shiody_

Reputation: 11

Xcode - How to auto select resource based on build config?

So just like the question's title, does Xcode have this feature so that we can select which resource to compile based on build config?

For example I have 2 build config: A and B
can I do something like this in my project structure:

- A
-- ui1.xib
-- ui1.swift

- B
-- ui1.xib
-- ui1.swift

- uiCommon.xib
- uiCommon.swift

so when I select build config A, the file in A folder that will be compiled automatically.
We can achieve this in Android by using Flavor right? Can we achieve this in xcode?

In Xcode we can just put anyname.~iphone.xib and anyname.~ipad.xib for different layout based on device types. Can we do something like this for build config?

Upvotes: 1

Views: 364

Answers (1)

Anton Malyshev
Anton Malyshev

Reputation: 8871

Click on the resource file at the left sidepanel in Xcode, then select document properties tab (sheet of paper icon) at the right sidepanel and change "Target Membership" option for needed resource.

To use the same resource name for different targets - place the resources in separate folders like TargetAResources, TargetBResources.

Upvotes: 0

Related Questions