Skip to content

Conversation

stephencelis
Copy link
Member

The current signatures were the result of fighting language changes in real time, and while it mostly worked in a non-default main actor world, I think this is more correct.

@_inheritActorContext _ apply: @escaping @isolated(any) @Sendable () -> Void
) -> ObserveToken {
observe(isolation: isolation) { _ in apply() }
observe { _ in Result(catching: apply).get() }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a trick similarly employed by the Observations type to convert an @isolated(any) to a synchronous function. I'm not sure if there is a more legit way to assume the isolation of a closure to perform it synchronously.

Copy link
Contributor

@maximkrouk maximkrouk Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fixing conflicts for #286 and looks like this implementation gives a bunch of warnings on Xcode 26 beta 4 🤔

Screenshot 2025-09-24 at 12 58 04 PM

Converting @isolated(any) function of type '@isolated(any) @Sendable (UITransaction) -> Void' to synchronous function type '@Sendable (UITransaction) -> Void' is not allowed; this will be an error in a future Swift language mode 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maximkrouk These warnings are fine. They even exist in Swift's Observation framework. Luckily they don't show up downstream.

@stephencelis stephencelis merged commit 923d507 into main Sep 10, 2025
5 checks passed
@stephencelis stephencelis deleted the isolated-any branch September 10, 2025 18:23
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.

3 participants