Post

Replies

Boosts

Views

Activity

NSControl.StateValue
Hi, I´m starting to code those days and now got stuck and can´t help myself out, so I´d be happy if someone could help me. The code is this: if let context = (NSApplication.shared.delegate as? AppDelegate)?.persistentContainer.viewContext { let toDoItem = ToDoItem(context: context) toDoItem.name = textField.stringValue if importantCheckBox.state == 0 { // Not important toDoItem.important = false } else { // Important toDoItem.important = true } (NSApplication.shared.delegate as? AppDelegate)?.saveAction(nil) It shows me following Binary operator '==' cannot be applied to operands of type 'NSControl.StateValue' and 'Int' The Problem seems to be the " == " May someone give me a hint to help me out? Thank you in advance and best wishes!
1
0
507
Nov ’21