I have a series of objects with an optional "comment" field, which contains a string. I'd like to extract all the comments and list them as separate lines in an NSTextField (or any other suitable view). So I did this...
@IBOutlet var CommentsTextView: NSTextView!
func CommentsInitialize() {
var cmt = ""
for c in document!.commentCards {
cmt += c.info["comment"] ?? "" + "\n"
}
CommentsTextView.string = cmt
}
The text appears, but as all one line run together. According to this it should just work, but the newlines simply aren't doing anything (and I tried \n, \r\n and \r). Am I missing something obvious? I can see in IB that there's a setting in the TextStorage for the newline mode, but I can't seem to set it, changing the value does nothing.
p.s. If you're wondering about the missing "weak", apparently that's an old Cocoa issue - with the weak in there it released and died