Skip to content

Conversation

dianaafanador3
Copy link
Contributor

This is extending the API for Realm.init() async to have a callback for progress notifications. Feature request here #7763.

@cla-bot cla-bot bot added the cla: yes label Nov 16, 2022
case .always:
rlmRealm = try await withCheckedThrowingContinuation { continuation in
RLMRealm.asyncOpen(with: configuration.rlmConfiguration, callbackQueue: .main) { (realm, error) in
let rlmTask = RLMRealm.asyncOpen(with: configuration.rlmConfiguration, callbackQueue: .main) { (realm, error) in

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because you can only run let 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 as AsyncSequences for sync progress notification.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants