I have a segmented control in a SettingsController.
The segmented control can display temperature in Celsius or Fahrenheit.
I have a mainViewController where I have the temperature label which displays current temperature in celsius.
On click of the segmented control I want to convert the temperature to appropriate unit and display it in the mainViewController.
@IBOutlet weak var temperatureUnitSegmentedControl: UISegmentedControl!
var mainViewController : MainViewController?
@IBAction func temperatureSegmentedControlListener(sender: UISegmentedControl) {
        switch temperatureUnitSegmentedControl.selectedSegmentIndex
        {
        case 0:
            showTemperatureInCelsius()
        case 1:
            showTemperatureInFahrenheit()
        default:
            break;
        }
    }
    func showTemperatureInCelsius(){
        mainViewController?.setTempInCelsius()
    }
    func showTemperatureInFahrenheit(){
            mainViewController?.setTempInFahrenheit()
    }
In mainViewController I want to do the conversions and update the temperature label
func setTempInCelsius(){
        temperatureLabel.text = "In Celsius"
        log?.debug("Temperature Celsius\(batteryTemperatureLabel.text)")
    }
    func setTempInFahrenheit(){
        temperatureLabel.text = "In Fahrenheit"
        log?.debug("Temperature Fahrenheit\(batteryTemperatureLabel.text)")
    }
This code does not hit the functions in the mainViewController and value of the label does not get updated.
Any help will be appreciated. Thank you
 
     
     
     
    