Last active
August 29, 2015 14:26
-
-
Save waltflanagan/e24a2d2a941d38a6b068 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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 | |
} |
This file contains hidden or 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
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