Search code examples
swiftmacosnstextfield

Access text variable of NSTextField?


I want to access the text variable of NSTextField ?

I'v tried this. But it's not working.

name = textfield.text

Error: "Value of type 'NSTextField' has no member 'text'"


Solution

  • Are you confusing it with UITextField on iOS? The corresponding property on Mac OS X is stringValue

    name = textfield.stringValue