Automattic / Gravatar-SDK-iOS

Gravatar SDK is a Swift library that allows you to integrate Gravatar features into your own iOS applications.
https://gravatar.com
Mozilla Public License 2.0
52 stars 5 forks source link

Fix concurrency warning about editingDidFinish #510

Closed pinarol closed 1 month ago

pinarol commented 1 month ago

Closes #

Description

Screenshot 2024-10-16 at 11 26 53

Swift implicitly assumes that editingDidFinish is an actor-isolated property(due to its use in a View protocol). To address this, we can explicitly mark the property as @MainActor, or alternatively, we can make editingDidFinish a @Sendable closure. I did the second which means we don't assume it must run on the main actor.

And then i got a new warning in our ImagePicker:

Screenshot 2024-10-16 at 12 01 19

Even though ImagePicker is a View, the system this time doesn't automatically assume it runs on the main actor. So I added the @MainActor explicitly.

And then i got:

Screenshot 2024-10-16 at 12 03 19

Then i put the call inside Task { ... }

Testing Steps

Test image picking & cropping.

wpmobilebot commented 1 month ago
Gravatar SwiftUI Prototype Build📲 You can test the changes from this Pull Request in Gravatar SwiftUI Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar SwiftUI Prototype Build Gravatar SwiftUI Prototype Build
Build Number1523
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-swiftui.prototype-build
Commita079fb38b3fc0f90d92ce0c71c5bbb2aa7bdd10d
App Center BuildGravatar SDK Demo - SwiftUI #283
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
wpmobilebot commented 1 month ago
Gravatar UIKit Prototype Build📲 You can test the changes from this Pull Request in Gravatar UIKit Prototype Build by scanning the QR code below to install the corresponding build.
App NameGravatar UIKit Prototype Build Gravatar UIKit Prototype Build
Build Number1523
Version1.0
Bundle IDcom.automattic.gravatar-sdk-demo-uikit.prototype-build
Commita079fb38b3fc0f90d92ce0c71c5bbb2aa7bdd10d
App Center BuildGravatar SDK Demo - UIKit #284
Automatticians: You can use our internal self-serve MC tool to give yourself access to App Center if needed.
pinarol commented 1 month ago

Closing this in favor of https://github.com/Automattic/Gravatar-SDK-iOS/pull/512