- Notifications
You must be signed in to change notification settings - Fork2.2k
Add progress callback to asynchronousasync await initialiser for Realm#8034
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| case.always: | ||
| rlmRealm=tryawaitwithCheckedThrowingContinuation{ continuationin | ||
| RLMRealm.asyncOpen(with: configuration.rlmConfiguration, callbackQueue:.main){(realm, error)in | ||
| letrlmTask=RLMRealm.asyncOpen(with: configuration.rlmConfiguration, callbackQueue:.main){(realm, error)in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Hey@dianaafanador3 thanks for the PR. Looking good.
What was your reasoning for fixing the callbackQueue to.main rather than letting an implementer pass in their preffered queue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Because you can only runlet realm = try await Realm() at the moment, in a@mainactor.
We are still discussing if this is the bet API for this, but we have a project in progress which should give better support for actor-confined Realms and offer a better experience with Swift concurrency in general, which should include exposing recurring callbacks asAsyncSequences for sync progress notification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
That's great, thanks@dianaafanador3
This is extending the API for
Realm.init()async to have a callback for progress notifications. Feature request here#7763.