Create Demo by separate Staging, Dev, and Production
I don't understand English well Because the English language
is not my native language. Sorry before you read.
Step 1 - Click on the project target and look at Configurations.
Step 2 - Click "+" button in configurations to add new environment (Before they have Debug and Release)
Step 3 - Choose a duplicate "Debug" configuration.
Step 4 - Add "SWIFT_ACTIVE_COMPILATION_CONDITIONS" This is a name that will use when the App needs to check the environment conditions in Swift programming
For Example
We need to build with an environment target.
step 1 - Click New Scheme
Step 2 - Make a new Scheme name (scheme name should likely be environment name.)
Step 3 - Choose Build with new Scheme and Click Edit Scheme.
Step 4 - Click Tab info and choose Build Configuration same scheme.
Step 1 - Right click in a folder in the project and choose "new file". After searching type with this picture.
Step 2 - Adding new configurations(Focus on "#include" when you used podfile.
#include "Pods/Target Support Files/Pods-EnvironmentSeparateDemo/Pods-EnvironmentSeparateDemo.staging.xcconfig"
#include "Pods/Target Support Files/Pods-EnvironmentSeparateDemoTests/Pods-EnvironmentSeparateDemoTests.staging.xcconfig"
APP_NAME = Demo Staging
VERSION_NAME = 1.0.0
PAGE1_CONFIG_TITLE = Hi Staging.
PAGE1_CONFIG_TITLE2 = I am Developer Staging.
PAGE1_CONFIG_TITLE3 = I live in Thailand Staging.
private func setUpUI() {
let infoDictionary = Bundle.main.infoDictionary
if let title1 = infoDictionary?["MyKeyLabel1"] as? String {
self.title1Label.text = title1
}
if let title2 = infoDictionary?["MyKeyLabel2"] as? String {
self.title2Label.text = title2
}
if let title3 = infoDictionary?["MyKeyLabel3"] as? String {
self.title3Label.text = title3
}
}