Closed maratal closed 2 months ago
The updates introduce the NS_SWIFT_SENDABLE
annotation to various Objective-C interfaces in the Ably SDK, indicating that instances can be safely used across Swift concurrency contexts. Additionally, private headers and read-only properties are added to enhance encapsulation and manage mutability, ensuring better control over the state of objects.
File(s) | Change Summary |
---|---|
Source/include/Ably/ARTConnectionDetails.h , Source/include/Ably/ARTRestChannels.h , Source/include/Ably/ARTRealtimeChannels.h , Source/include/Ably/ARTDevicePushDetails.h |
Added NS_SWIFT_SENDABLE to enhance concurrency safety for respective interfaces. |
Source/include/Ably/ARTDeviceDetails.h |
Changed properties to read-only to enhance encapsulation and immutability. |
Ably.xcodeproj/project.pbxproj , Source/Ably.modulemap , Source/PrivateHeaders/... |
Added private headers to improve encapsulation and internal management of device details. |
Source/ARTDevicePushDetails.m , Source/ARTJsonLikeEncoder.m |
Introduced mechanisms to access private properties and enhance functionality. |
Test/Tests/RealtimeClientChannelTests.swift |
Added a test to verify immutability of ARTRealtimeChannelOptions . |
Objective | Addressed | Explanation |
---|---|---|
Add Swift concurrency annotations to improve thread safety (ECO-4940, #1962) | β |
π° In fields so wide, where bunnies hop,
Swift concurrency now has a safer crop.
WithNS_SWIFT_SENDABLE
, our paths align,
In harmony, Objective-C and Swift entwine.
Celebrate the change, letβs all take a leap,
For safe threads await, in code we keep! πΌ
[!TIP] We have updated our review workflow to use the Anthropic's Claude family of models. Please share any feedback in the discussion post on our Discord.
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Please can you mention the resolved issue in the commit message?
Please can you mention the resolved issue in the commit message?
Done.
Iβm curious why you've annotated some of the types in
PrivateHeaders
?
Yeah, Xcode doesn't show real file path, so somehow those ended up there, sorry, fixed in https://github.com/ably/ably-cocoa/pull/1963/commits/de49b6705f470dfde272384918b447c7cc37420c
LGTM once @lawrence-forooghian is happy with the open conversation
Looks good, I just want to test it out in Chat to check that it makes our warnings go away, will do that shortly
It seems like
ARTRealtimeChannels
isn't marked as sendable. Please could you address that and have another check of everything to make sure there isn't anything else missed?
Made a quick check and added private interface to ARTDevicePushDetails
as well. Also made it sendable. I'll need Xcode 16 for a proper review of all warnings, so let me know if you find anything else before that.
Tested again in Chat and there are no warnings now. Still might be some types that Chat isn't using that aren't covered here, but Iβm happy to approve and address other needs if we discover them.
I've added
NS_SWIFT_SENDABLE
to every type that has a docstring and their accompanied enums and params types.Closes #1962
Summary by CodeRabbit
New Features
NS_SWIFT_SENDABLE
attribute to multiple interfaces, enhancing compatibility with Swift's concurrency model for safer multi-threaded use.Improvements
ARTDeviceDetails
andARTDevicePushDetails
to be read-only, enhancing encapsulation.ARTChannelOptions
, reinforcing data integrity.tryInObjC
function.ARTRealtimeChannelOptions
, ensuring robust channel configuration.