I want to set some tokens in a NSTokenField, when it appears.
Apple document says: setObjectValue:
I try to set tokens usign setObjectValue
tokenField.setObjectValue(["One","Two"])
but it doesn't´t compile.
What´s the correct method?
objectValue
is a property defined in NSControl
. In Objective-C, you can set a value to it, in both property notation or setter method setObjectValue:
. But in Swift, you always need to use property notation -- simple assignment:
tokenField.objectValue = ["One","Two"]