Why does returning EmptyView make AsyncImage not work?

361 views Asked by At

This code loads the image:

AsyncImage(url: URL(string: "https://ychef.files.bbci.co.uk/976x549/p01j3jyb.jpg")) { phase in
    switch phase {
    case .success(let image):
        image
            .resizable()
            .frame(width: 140, height: 140)
    default:
        Text("empty")
    }
}

This code does not:

AsyncImage(url: URL(string: "https://ychef.files.bbci.co.uk/976x549/p01j3jyb.jpg")) { phase in
    switch phase {
    case .success(let image):
        image
            .resizable()
            .frame(width: 140, height: 140)
    default:
        EmptyView()
    }
}

Why? The only difference is the default case.

Xcode 13.3.1

0

There are 0 answers