Skip to content

Non Sendable Types #21

@JCKL

Description

@JCKL

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions