Post

Replies

Boosts

Views

Activity

Reply to Swift 6 Concurrency Errors with MKLocalSearchCompleterDelegate results
Thank you, @DTS Engineer. I would also expect this approach to work, but the compiler disagrees on two points: Task { @MainActor in let suggestedCompletions = completer.results // (with or without the .yield() } Error: Task or actor isolated value cannot be sent and Task { @MainActor in ... resultStreamContinuation?.yield(suggestedCompletions) } Error: Sending 'suggestedCompletions' risks causing data races Main actor-isolated 'suggestedCompletions' is passed as a 'sending' parameter; Uses in callee may race with later main actor-isolated uses (for my own understanding): Is the error suggesting the completer.results reference may have changed by the time the Task { ... } is scheduled/executed?
Aug ’24