I have an NSButton Checkbox on Xcode using Swift 3 for making macOS applications. I'm trying to check the state (whether its on or off). Some options I have found, such as : if ([Switch1 state] == NSOnState) { //CODE}
When I do this, it tells me to inout a comma after "Switch 1". Is this right, or is this version of code too old for Swift 3?
`@IBOutlet weak var Switch1: NSButton!
override func viewDidLoad() {
super.viewDidLoad()
if ([Switch1 state] == NSOnState) {
print("On")
}
}`
Aucun commentaire:
Enregistrer un commentaire