I\'m working on a unit converter written in Swift that will automatically display the updated units within the appropriate NSTextField
s. For this example, if the us
You need to move the setting of the text fields' values out of viewDidLoad()
to a separate method. Call that method from viewDidLoad()
and also from a didSet
property observer on your seconds
property.
You also need to create action methods for when the seconds, minutes, or hours fields are changed. In the action method for the seconds field, set the seconds
property to secondsField.floatValue
. Similarly for the other two fields. In the NIB/storyboard, connects the text fields' actions to the corresponding action method on the view controller.