Unwanted deprecation warning for changed initializer parameter optionality

Why am I getting a deprecation warning here? And what can I do to make the warning go away?

You can see in CloudKit header that an initializer parameter changed from optional to non-optional.

The compiler to chooses to warn me about the older initializer with optional parameter, and doesn’t realize that there is a newer initializer with non-optional parameter.

I would just suppress this warning, but looks like there is no way for me to do that.

Xcode Version 26.1.1 (17B100)

Maybe just force the parameter to be non-optional?

CKRecordZone. ID(zoneName: "Chats" , 
    ownerName: henry.remoteCreatorUserRecordName ?? CKCurrentUserDefaultName)
1 Like

Ahhh… indeed. The compiler picked the deprecated initializer because henry.remoteCreatorUserRecordName was an optional property on henry. When I make it non-optional, the warning goes away. Thank you :smiley:

This was a user error, but compiler could have given me a bit of guidance. “Initializer with optional parameter is deprecated. Do you really mean this value to be optional”