Skip to content

ioscodigo/ICEnvironmentSetting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICEnvironmentSetting

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Minimum Requirements

iOS8+ Swift 3.0 XCode 8.0

Installation

ICEnvironmentSetting is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ICEnvironmentSetting"

Usage

Setup Environment on AppDelegate

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
}

Setup Listener

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

Author

Fajar Agung W, fajar@codigo.id

License

ICEnvironmentSetting is available under the MIT license. See the LICENSE file for more info.