xcode cannot resolve the entered keypath

66 Views Asked by At

Using Xcode 12, and starting with the default XIB-based swift desktop app, I add a Model class, descended from NSObject with a single stringValue property. In the XIB file I instantiate the Model class, and add a text field to the default window, and bind the value of the text field to the stringValue property of my Model instance. The project builds and runs, and any value I set in the initializer of the Model class displays in the text field.

Here is my Model class:

import Foundation

@objc public class Model : NSObject {
  @objc dynamic public var stringValue: NSString
  
  override init() {
    stringValue = "some string"
  }
}

The full project is available here:

https://github.com/thomasmarschall/KvoLab2023

I started with a bit more complicated setup involving a separate library and framework, but my current setup seems to be super straightforward.

Having done all of this, Xcode displays a grey flag in the Model Key Path field of the text field value binding, and the tool tip for the flag reads "xcode cannot resolve the entered keypath". Also, the autocomplete in the key path field does not work. How can I resolve these issues? Any help would be appreciated.

0

There are 0 best solutions below