-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
MacOS 15 / Xcode 16: asyncWrite chokes at compile time #8687
Comments
➤ PM Bot commented: Jira ticket: RCOCOA-2434 |
Naive workaround that circumvents the compile problem: extension Realm {
func asyncWrite<T>(_ block: @escaping (Realm) throws -> T) async throws -> T {
return try await withCheckedThrowingContinuation { continuation in
DispatchQueue(label: "xx.yy.zz").async {
do {
let realm = try Realm(configuration: self.configuration)
try realm.write {
let result = try block(realm)
continuation.resume(returning: result)
}
} catch {
continuation.resume(throwing: error)
}
}
}
}
} |
I had the same problem and found another solution. I created a DatabaseActor and passed it to the asyncWrite method.
|
Thank you @nikolay-mdev, this fixed it for me. Looking into it a little more it looks like this is present when using v6 or greater of the Swift compiler. It seems You can check your swift version in a terminal with: |
After running into the same error, I believe the simple issue is the method's use of
|
This is working as intended other than that the Swift compiler is crashing rather than reporting an error, which obviously is a bug in the compiler. Both |
How frequently does the bug occur?
Always
Description
The use of asyncWrite makes Xcode 16 unhappy upon compilation. This seems to be the case whether using Swift 5 or 6. Simple example:
Presumably it's some fallout from the new concurrency checks. Swap to .write and no problems compiling.
Stacktrace & log output
Can you reproduce the bug?
Always
Reproduction Steps
No response
Version
20.0.0
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
iOS 17 / 18
Build environment
The text was updated successfully, but these errors were encountered: