I have a segmented controller that I click, it then changes 6 labels at once with a different value (metric to imperial).
I have that working but when i change to a different page and come back the selector resets to position 0. is there a way to save the position selected when i leave the controller and comeback. I say controller but its only one controller with many nib files that run like a book so when i turn the page and go back it is back in the original position.
I tried this code in may view did appear but no luck.
if measurementSwitch == 0 {
    metricImperialSwitch?.selectedSegmentIndex = 0
         print(measurementSwitch)
    }else {
        metricImperialSwitch?.selectedSegmentIndex = 1
        print(measurementSwitch)
    }
and here is the function.
func P18Switch() {
        if metricImperialSwitch.selectedSegmentIndex == 0
        {
            measurementSwitch = 0
            CWLabel.text = "kg"; TWLabel.text = "kg"; CWaLabel.text = "cm"; TWaLabel.text = "cm"; CHLabel.text = "cm"; THLabel.text = "cm"
        }
        else if metricImperialSwitch.selectedSegmentIndex == 1
        {
            measurementSwitch = 1
            CWLabel.text = "st"; TWLabel.text = "st"; CWaLabel.text = "inch"; TWaLabel.text = "inch"; CHLabel.text = "inch"; THLabel.text = "inch"
        }
}
and then calling the function in view did load.
 
     
    