Sendable warnings are causing a lot of confusion

Nearly all the examples in Meet async/await WWDC talk generate warnings:

struct ThumbnailView: View {
    @ObservedObject var viewModel: ViewModel
    var post: Post
    @State private var image: UIImage?

    var body: some View {
        Image(uiImage: self.image ?? placeholder)
            .onAppear {
                Task {
                    self.image = try? await self.viewModel.fetchThumbnail(for: post.id)
                }
            }
    }
}

another example:

func fetchThumbnail(for id: String) async throws -> UIImage {
    let request = thumbnailURLRequest(for: id)  
    let (data, response) = try await URLSession.shared.data(for: request)
    guard (response as? HTTPURLResponse)?.statusCode == 200 else { throw FetchError.badID }
    let maybeImage = UIImage(data: data)
    guard let thumbnail = await maybeImage?.thumbnail else { throw FetchError.badImage }
    return thumbnail
}

I have no idea what to do now or what to tell to people who ask me.

There is no simple test to know if anything is safe to mark as sendable.

Data? How do I know? In the protobuf project they were saying that sometimes data is not sendable...

Image? No idea...

This is really confusing

1 Like

Cannot pass argument of non-sendable type 'Date?' across actors
Capture of 'modifiedAt' with non-sendable type 'Date?' in a @Sendable closure

What should I do? Should I mark it sendable?

Capture of 'data' with non-sendable type 'Data' in a @Sendable closure

Again I have no idea what to do...

Had the same question and turns out that Xcode 13.3 b1 is missing logic to surpress those warnings and it therefore very noisy. I found it on this forum but cant seem to find the link.
Personally im not gonna use b1 to fix sendable warnings and im going to wait for later betas or even the rc.

The excessive Sendable warnings are a known issue with Swift 5.6 snapshots. You can avoid them by using Swift 5.5 (i.e. using Xcode 13.2.1 instead of the Xcode 13.3 beta).