Using Xcode Configuration (.xcconfig) to Manage Different Build Settings
Complete Tutorial To Organise iOS Xcode Project Staging, Development, and Release States With .xcconfig Files Or Automatic Building without API Urls Changes.
App Constant for Api Key with Automatic Build
Once app development started , always have two or three development mode like(Development, Staging and Release).
In Development Mode :- if App has backend server , app server has definitely development api mode in which we develop app features , more reliable and bug free app or remove all crashes from app code. Here we can test app many times to improve app overall performance.
In Staging Mode :- After Development mode , we again re-test for confirmation or need to change few things that not available on development mode like real time testing etc.
In Release Mode :- app is on App Store and app has release api mode.
In Development Mode :- if App has backend server , app server has definitely development api mode in which we develop app features , more reliable and bug free app or remove all crashes from app code. Here we can test app many times to improve app overall performance.
In Staging Mode :- After Development mode , we again re-test for confirmation or need to change few things that not available on development mode like real time testing etc.
In Release Mode :- app is on App Store and app has release api mode.
All your api URLs and API keys stored on a Constant file or the info.plist file.
This tutorial help you setting up different configuration of your app through schemes for states of the app: Development ,Staging and Release — and specifying our configurations in the Project Settings.
Add .xcconfig Files To Your Xcode Project
Add .xcconfig Files To Your Xcode Project
- Create new iOS project in Xcode or not if you have already.
- In project create folder — I used Configuration. We have added three .xcconfig files: Development, Staging and Release.
2. Project Settings need configuration files. For that have to create an extra Configuration for Development , Staging and Release
If Cocoapods Not Installed , Skip to #3. If Cocoapods are installed , delete .xcworkspace file, the Podfile.lock, and the Pods/ directory. Do not delete the Podfile.
Then, go to your terminal. Make sure that you’re in the project directory and run
pod install.Now, open the newly generated .xcworkspace file and add the .xcconfigpath for Cocoapods in your own .xcconfig file.3. Add new schemes to your project and make sure your target is your XCode project name. Set up your scheme to correspond to your configuration.
5. Now Add Swift Constant File into Your Project and Setup your Coding for Different API URLs.
Note
- Never putt a string as a value for key within a .xcconfig file — it automatically stringifies any value.
- You can find the working code here if you weren’t using Cocoapods. Please let me know if you have any questions!







Thanks you for this informational tutorial...
ReplyDelete