Post

Replies

Boosts

Views

Activity

Reply to Understanding the warning and how to fix it: Non-sendable cannot cross actor boundary
I have a similar situation. I have a CKMethods protocol which I use in a number of View Controllers. I get warnings about CKRecord not being sendable. What I've been doing to try to fix it is to move the functions into the View Controllers. But now I'm stuck with this among other warnings. let matchTemp = try await database.records(for: recIDs) Non-sendable type '[CKRecord.ID : Result<CKRecord, any Error>]' returned by call from main actor-isolated context to non-isolated instance method 'records(for:desiredKeys:)' cannot cross actor boundary Here's another one. let results = try await database.modifyRecords(saving: records, deleting: [], savePolicy: .allKeys, atomically: false) 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
Topic: Programming Languages SubTopic: Swift Tags:
Mar ’23
Reply to SwiftUI 4: Set list background color
Try this. struct ContentView: View {     var body: some View {         List {             ForEach(0..<1) {_ in                 Text("Hello World")             }             .listRowBackground(Color.red)         }         .listStyle(.insetGrouped)     } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Sep ’22