Skip to content

Instantly share code, notes, and snippets.

@waltflanagan
Last active August 29, 2015 14:26
Show Gist options
  • Save waltflanagan/e24a2d2a941d38a6b068 to your computer and use it in GitHub Desktop.
Save waltflanagan/e24a2d2a941d38a6b068 to your computer and use it in GitHub Desktop.
func viewDidLoad() {
super.viewDidLoad()
let currentEnvironment = EnvironmentManager.currentEnvironment()
self.selectSegmentForEnvironment(currentEnvironment)
// Do any additional setup after loading the view.
}
func selectSegmentForEnvironment(environment:Environment) {
let index: Int
switch environment.vintage {
case .Production :
index = 0
case .Staging:
index = 1
case .Local:
index = 2
}
self.environmentSelectionControl.selectedSegmentIndex = index
}
extension EnvironmentVintage {
private func segmentIndex() -> Int{
let index: Int
switch self {
case .Production :
index = 0
case .Staging:
index = 1
case .Local:
index = 2
}
return index
}
}
override func viewDidLoad() {
super.viewDidLoad()
let currentEnvironment = EnvironmentManager.currentEnvironment()
self.environmentSelectionControl.selectedSegmentIndex = currentEnvironment.vintage.segmentIndex()
// Do any additional setup after loading the view.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment