Created
April 1, 2019 02:02
-
-
Save Vinod-kumar-ios/888c01187232346d58440eaf84a20b4f to your computer and use it in GitHub Desktop.
Code given below
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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