Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add @MainActor attribute to animation closure of custom transition #2300

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

mlight3
Copy link

@mlight3 mlight3 commented Oct 9, 2024

Warning occurs when set imageView.image in animation closure of custom transition.

let transition = .custom(duration: 0.2, options: .curveEaseIn, animations: { imageView, image in
    imageView.image = image
    //  Main actor-isolated property 'image' can not be mutated from a Sendable closure; this is an error in the Swift 6 language mode
}, completion: nil)

So I added @MainActor attribute to animations parameter because animations should be executed on main thread.

@onevcat onevcat merged commit e72fedd into onevcat:master Oct 9, 2024
16 checks passed
@mlight3 mlight3 deleted the mlight3/mainactor branch October 9, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants