0

Say a user enters some text hey into a NSTextField. I would like to extract this text to a NSString, but for some reason, I can't.

I've been trying to find the answer to this question and I've seen many answers on this website saying that you can use NSString *string = [textField stringValue] from "Getting the text from a NSTextField and setting it to an already defined String", but I get the errors "Expected ',' separator" between NSString and *string and "Consecutive statements on a line must be separated by ';'" between textField and stringValue.

How would you store the contents in the NSTextField to a string?

Community
  • 1
  • 1
perhapsmaybeharry
  • 874
  • 3
  • 13
  • 32
  • `NSString *string = [textField stringValue]` is Objective-C. It won't magically compile in a Swift file. – Martin R May 09 '15 at 08:47
  • Thank you for pointing out the possible duplicate. I didn't find that with my searches, it was the solution I needed. Though, I wanted to store it into a string, not to println() it. – perhapsmaybeharry May 09 '15 at 08:53

0 Answers0