-
Notifications
You must be signed in to change notification settings - Fork 2
Groundwork for object sync #20
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
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The accompanying ably-cocoa change requires it.
Mark most of its types as Sendable, and callbacks as `sending`. I was going to defer this until later but when I started writing integration tests I realised that it's quite hard to actually use the SDK without any sort of concurrency annotations (many basic things that you try and do with it trigger a compiler error). I haven't added annotations to the BatchContext things yet (because they never leave the callback so may not need it); will address that once we need to test those APIs. Marking things as Sendable is consistent with the ably-cocoa public API, which I think is going to the approach that we take threading-wise (but will revisit in #3).
This was a mistake in ce8c022, in which I did not intend to add methods that unsubscribe a given callback (since you can't compare closures by reference in Swift). The equivalent functionality already exists via OnLiveObjectLifecycleEventResponse.off().
I _think_ that there are enough times that you want to subscribe to events without worrying about subsequently unsubscribing (in tests, but I think also in real life, especially when just playing around with the SDK) that we shouldn't make users think about the return value of these methods.
I didn't copy the type across from JS correctly in ce8c022; their LiveMapType is really just a dictionary with typed values.
When I copied the public API from JS in ce8c022 I didn't yet have enough context to know how to translate the use of JS's `number` type. Now from RTLc5 it's clear that counters are floating-point.
For mocking in some upcoming tests. I've also decided to make the internals of the SDK not need to worry about our current memory management confusion, which will be revisited in #9.
umair-ably
approved these changes
Jul 23, 2025
Collaborator
umair-ably
left a comment
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.
cool use of Swift 6 e.g. sending - not seen it in use before!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Note: This PR is based on top of #19; please review that one first.
Some miscellaneous changes so that the upcoming
OBJECT_SYNCspec implementation PR isn't too large. See commit messages for details.