dmytro-anokhin / url-image

AsyncImage before iOS 15. Lightweight, pure SwiftUI Image view, that displays an image downloaded from URL, with auxiliary views and local cache.
MIT License
1.1k stars 96 forks source link

Cannot convert value of type 'some View' to closure result type '_' #80

Closed gatfil closed 4 years ago

gatfil commented 4 years ago

Hi, I follow this example: Using in a view and I have return this error: Cannot convert value of type 'some View' to closure result type '_' (ERROR 1) If I remove the line I have return this error (ERROR 2): Cannot convert value of type 'some View' to closure result type 'Image'

import SwiftUI
import Combine
import URLImage

struct CircleImageUrl: View {
    let imageUrl: URL
    var body: some View {
        HStack {
            URLImage(imageUrl,
                placeholder: {
                    ProgressView($0) { progress in
                        ZStack {
                            if progress > 0.0 {
                                CircleProgressView(progress).stroke(lineWidth: 2.0)
                            }
                            else {
                                CircleActivityView().stroke(lineWidth: 3.0)
                            }
                        }
                    }
                    .frame(width: 35.0, height: 35.0) //ERROR 1
                },
                content: {
                    $0.image
                    .resizable()
                    .frame(width: 35.0, height: 35.0)
                    .clipShape(Circle())
                    .overlay(Circle().stroke(Color.white, lineWidth: 2))
                    .shadow(radius: 2) //ERROR 2
            })
        }
    }
}

struct CircleImageUrl_Previews: PreviewProvider {
    static var previews: some View {
CircleImageUrl(imageUrl: URL(string: String("https://www.gatfil.it/ehi_brixia/images/attrazioni/castello_brescia.jpeg"))!
        )
    }
}

Thank you Filippo

dmytro-anokhin commented 4 years ago

Duplicate of #79. Fixed in 0.9.18