Skip to content

Instantly share code, notes, and snippets.

@Vinod-kumar-ios
Created April 1, 2019 02:02
Show Gist options
  • Save Vinod-kumar-ios/888c01187232346d58440eaf84a20b4f to your computer and use it in GitHub Desktop.
Save Vinod-kumar-ios/888c01187232346d58440eaf84a20b4f to your computer and use it in GitHub Desktop.
Code given below
import UIKit
struct Configuration {
lazy var environment: Environment = {
if let configuration = Bundle.main.object(forInfoDictionaryKey: "Configuration") as? String {
if configuration == Environment.StagingDebug.rawValue{
return Environment.StagingDebug
}else{
return Environment.ProductionRelease
}
}
return Environment.ProductionRelease
}()
}
enum Environment: String {
case StagingDebug = "Staging Debug"
case ProductionRelease = " Production Release"
var baseURL: String {
switch self {
case .StagingDebug: return "https://staging-api.myservice.com"
case .ProductionRelease: return "https://api.myservice.com"
}
}
var token: String {
switch self {
case .StagingDebug: return "lktopir156dsq16sbi8Staging"
case .ProductionRelease: return "5zdsegr16ipsbi1lktpProduction"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment