Please Create a Sendable Version of CKRecord or Make CKRecord Sendable

CKRecord is a class which does not conform to the Sendable protocol. Its fields consist of NSStrings, NSData and others which are not Sendable. I understand that Apple is incrementally modifying objects to be sendable, but I am experiencing and I would assume others are experiencing a very large number of warnings (for now) about CKRecords and Sendable.

It may be too much to make CKRecord Sendable and it may be too much to create a Sendable version of CKRecord, but it would be nice if it could at least be investigated.

My particular situation is I have created a Protocol named CKMethods which some of my view controllers use to download and upload CKRecords. I suddenly have a large number of warnings about non-sendable types being sent from main actor-isolated context to non-isolated instance method. The CKRecords sent to and from the protocol do not get mutated and I have never had a problem with data races in the years that I have had this protocol. At some point, the warnings will probably become errors and I definitely do not want to get to that point.

I am still coming up to speed on Swift Concurrency, so there may be a more simple solution than the one I am working on - creating a Sendable Struct for every CKRecord type that I have in my app and modifying all of the methods to pass the Struct instead of a CKRecord and convert the Struct to a CKRecord for upload and convert the CKRecord to the Struct for download.

Answered by interferon in 791577022

In case anyone comes across this topic in the future, CKRecord is now officially Sendable (source).

I believe this change was made in iOS 17.

You can take responsibility for it being Sendable. By default the Sendable protocol is made unavailable to CKRecord.

extension CKRecord : @unchecked Sendable {
}

But these are the supported types that are sendable by default. https://developer.apple.com/documentation/swift/sendable

NSFoundation types mention above NSStrings, NSData will not be Sendable but the Swift Foundation types Strings, Data are.

Accepted Answer

it would be nice if it could at least be investigated.

I recommend that you file an enhancement request for this. See tip 1 in Quinn’s Top Ten DevForums Tips.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

In case anyone comes across this topic in the future, CKRecord is now officially Sendable (source).

I believe this change was made in iOS 17.

Please Create a Sendable Version of CKRecord or Make CKRecord Sendable
 
 
Q