So this isn’t only a tutorial on use configuration recordsdata in Xcode; it additionally talks in regards to the emotion behind bettering and utilizing xcconfig recordsdata. This concept hit me after I needed to make clones of my challenge. So why do you have to create a brand new challenge when we’ve got GOD’s reward in our fingers’ configuration recordsdata, amigos?
For many who don’t learn about configuration recordsdata, examine it in my earlier article:
Now, let’s begin by making a challenge known as GodsGift
. Set up one or two pods to your challenge as a result of most require third-party assist. In the event you don’t want it, it’s icing on the cake, and you’ll declare your self the Supreme Energy.
In the event you’ve put in your pods in any of your initiatives, open their workspace file. In case your challenge doesn’t require any exterior pods, open your xcodeproj file, and also you’ll see two default configurations, i.e., Debug and Launch. These are proven under:
Within the picture above, you may see that Pods-GodsGift.debug
is related to the Debug configuration, and Pods-GodsGift.launch
is related to the Launch configuration. Now we are able to create two configurations in every challenge, Growth and Manufacturing, rename the default Debug Launch to the Venture identify, and add new recordsdata by way of the + button in Configurations.
Project1 and Project2 are proven within the above picture; they’re made with the event and manufacturing configurations. However the entire improvement and manufacturing is linked to the identical sort of .xcconfig recordsdata: Pods-xxxxxxxx.xxxx. So now, we’ll manually create 4 .xcconfig recordsdata associated to our initiatives.
Listed here are the recordsdata we simply created:
Now, use these recordsdata in your Xcode challenge’s configurations as proven under:
Now, construct your challenge.
Uh-oh. Your challenge acquired an error associated to Pods-xxxxxxx.xcfilelist.
So, realizing this, we have to import our Pods’ debug and launch xcfilelist into our manually generated .xcconfig recordsdata. That is advisable everytime you create new xcconfig recordsdata.
First, uninstall the pods, then reinstall them. A brand new xcfilelist will probably be created; it’s associated to the xcconfig file used within the configuration we imported contained in the 4 xcconfig recordsdata we created earlier.
Now, we’re performed importing the red-marked recordsdata into our green-marked recordsdata. The yellow areas within the above picture will help you see this.
Use this code so as to add these recordsdata to the xcconfig recordsdata you created manually:
#embody "Pods/Goal Assist Information/Pods-PROJECT_NAME/Pods-PODS_XCONFIG_NAME.xcconfig"
Now that your error associated to Pods-xxxxxxx.xcfilelist is gone, you may run and take a look at it.
Inside your xcconfig recordsdata, you may put something like BundleId
, Model
, Construct Model, BasePath
, FacebookID
, Google Plist file identify, any SDK keys, APP_ICON
asset identify, and Launch Display screen Identify that’s totally different for every app.
And you should use this stuff dynamically within the Venture Construct Settings by setting the $(XCCONFIG_KEY)
, so now if you happen to change something within the xcconfig file, it will likely be modified within the app additionally. After utilizing the xcconfig recordsdata, don’t you dare change this stuff manually from Xcode. Change this stuff from xcconfig recordsdata solely. In any other case, your work will go to crap due to a single mistake, Ha, ha!
So, do it fastidiously!
Let’s create some non permanent keys contained in the xcconfig recordsdata.