Cocoa 可可中的约束问题

Cocoa 可可中的约束问题,cocoa,Cocoa,我尝试将NSTextView绑定到Document.swift中声明的NSAttributedString,以将文本保存到文件中,但它没有任何作用 以下是ViewController.swift中的代码: var document: Document? { return view.window?.windowController?.document as? Document } 以及模型关键路径: self.document.text 欢迎来到堆栈溢出。绑定使用Key-Value-O

我尝试将NSTextView绑定到Document.swift中声明的NSAttributedString,以将文本保存到文件中,但它没有任何作用

以下是ViewController.swift中的代码:

var document: Document? {
    return view.window?.windowController?.document as? Document
}
以及模型关键路径:

self.document.text

欢迎来到堆栈溢出。绑定使用Key-Value-Observing(KVO),并且密钥路径中的所有属性都必须是。那么我应该怎么做?绑定到符合KVO的密钥路径还是不使用绑定。