shaps80 / SwiftUIBackports

A collection of SwiftUI backports for iOS, macOS, tvOS and watchOS
MIT License
931 stars 59 forks source link

Fix the used actor in the task view modifier that should inherit from context instead of main actor #58

Closed qeude closed 11 months ago

qeude commented 1 year ago

Describe your changes

In the current implementation made by Apple, we can see in the signature that the action isn't flagged as @MainActor

image

This is because the action isn't forced to run on the main actor, instead, it does inherit from the context actor. This article explains it better than I would do.

I did remove the conformance to @MainActor to add @_inheritActorContext on the action parameter so we are ISO with the implementation in iOS>14