To run the example project, clone the repo, and run pod install
from the Example directory first.
iOS8+ Swift 3.0 XCode 8.0
ICEnvironmentSetting is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "ICEnvironmentSetting"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [ UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Default development
ICEnvironmentSetting.setup(window: self.window!)
// you can set default environment
ICEnvironmentSetting.setup(window: self.window!,defaultEnv: .STAGGING)
//Setup your URL API environment
ICEnvironmentSetting.setupBaseURL(development: "DEV", staging: "STG", production: "PROD")
return true
}
Add delegate on home your app
ICEnvironmentSettingDelegate
func reloadEnvironment(environment: ENVIRONMENT) {
//Reload data when environment change
}
Add touch to switch environment with three fingers
ICEnvironmentSetting.setupTouch(self.view)
You can use string extension with modify environment
let homeURL = "/home"
request(homeURL.ENV) //see example more info
Fajar Agung W, fajar@codigo.id
ICEnvironmentSetting is available under the MIT license. See the LICENSE file for more info.