How to use NSStepper in Appkit

Issue #409

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
let stepper = NSStepper()
let textField = NSTextField(wrappingLabelWithString: "\(myLocalCount)")

stepper.integerValue = myLocalCount
stepper.minValue = 5
stepper.maxValue = 24
stepper.valueWraps = false

stepper.target = self
stepper.action = #selector(onStepperChange(_:))

@objc func onStepperChange(_ sender: NSStepper) {
myLocalCount = sender.integerValue
textField.stringValue = "\(sender.integerValue)"
}

Comments