MainActor isolation vs protocol conformance

Experimentally, I tried setting "strict concurrency checking" in my project to Complete. This got me some messages like this:

warning build: Instance method 'tableView(_:viewFor:row:)' isolated to global actor 'MainActor' can not satisfy corresponding requirement from protocol 'NSTableViewDelegate'

In some cases, this can be solved by making the function nonisolated. But for NSTableViewDelegate methods, I'm going to be calling my table view for various things, and those calls will be MainActor isolated too, so that's not going to work well.

What's the best solution here? Or should the NSTableViewDelegate protocol actually just be tagged as @MainActor since pretty much any implementation is going to have this situation?

I would guess that NSTableViewDelegate needs to be marked as @MainActor, yeah.

1 Like