I've looked and looked and can't seem to find anything obviously wrong, so I'll ask here. Are NSTableViewAppIntentsDataSource protocol methods expected to be called? Have others had success with this?
I've got an extremely trivial NSViewController subclass that conforms to NSTableViewDataSource, NSTableViewDelegate, NSTableViewAppIntentsDataSource.
Things I've verified:
The NSTableView is setup in a storyboard and the delegate and data source are connected to the view controller. In viewDidLoad while attached to the debugger I see this works.
The table view includes a single row and appears populated when running the app.
There seems to be no way to assign the appIntentsDataSource view controller in the storyboard, so that's assigned in code in viewDidLoad for the view controller. I can confirm it's correctly set in the data source methods for the table view.
I have an AppEntity conforming type and AppIntentsPackage conforming type in the project. I can look at the actionsdata in the built product to confirm the entity is registered.
Here's the entirety of the view controller:
class ViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate, NSTableViewAppIntentsDataSource {
@IBOutlet var tableView: NSTableView!
func numberOfRows(in tableView: NSTableView) -> Int {
print("numberOfRows(in:)")
return 1
}
dynamic public func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? {
print("tableView(_:objectValueFor:row:)")
return NSObject()
}
override func viewDidLoad() {
super.viewDidLoad()
tableView.appIntentsDataSource = self
}
override var representedObject: Any? {
didSet {
// Update the view, if already loaded.
}
}
dynamic public func tableView(_ tableView: NSTableView, appEntityIdentifierFor row: Int) -> EntityIdentifier? {
print("ViewController.tableView(_:appEntityIdentifierFor:)")
return EntityIdentifier(for: MyFancyEntity.self, identifier: "1234")
}
}
Unfortunately, while attached with a debugger, ViewController.tableView(_:appEntityIdentifierFor:) just never seems to be called.
0
0
206