apple / apple/sample-cloudkit-sharing

Non Sendable Types

Open
#21 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
331
Forks
37
PR merge metrics
No merged PRs in 30d

Description

When I run this sample code In Xcode 14.3. I get the following warnings:

- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:74:68 Non-sendable type '[CKRecordZone]' passed in implicitly asynchronous call to main actor-isolated function cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:74:73 Non-sendable type 'CKRecordZone' in asynchronous access to main actor-isolated property 'recordZone' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:91:32 Non-sendable type 'CKRecord' returned by call from main actor-isolated context to non-isolated instance method 'save' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:91:32 Non-sendable type 'CKRecord' exiting main actor-isolated context in call to non-isolated instance method 'save' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:107:36 Non-sendable type '[CKRecord]' exiting main actor-isolated context in call to non-isolated instance method 'modifyRecords(saving:deleting:savePolicy:atomically:)' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:111:46 Non-sendable type 'CKRecord' returned by call from main actor-isolated context to non-isolated instance method 'record(for:)' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:160:46 Capture of 'zone' with non-sendable type 'CKRecordZone' in a `@Sendable` closure
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:175:67 Non-sendable type '[CKRecordZone]' returned by call from main actor-isolated context to non-isolated instance method 'allRecordZones()' cannot cross actor boundary
- /sample-cloudkit-sharing/Sharing/ViewModels/ViewModel.swift:191:36 Non-sendable type '[CKRecordZone]' exiting main actor-isolated context in call to non-isolated instance method 'modifyRecordZones(saving:deleting:)' cannot cross actor boundary

Until CKRecord, CKRecordZone become Sendable Types, what is a workaround for this sample code?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.