Problem
In SwiftUI 3, I got an error "Cannot convert value of type 'Binding' to expected argument type 'UIImage'".
The Elements to display is Binding type, so I want to know:
- How to Remove Binding attribute from variable? Biding -> UIimage?
- Please tell us how to display Binding element in SwiftUI
code
/**
@State private var results: [ImageData] = []
struct ImageData: Identifiable {
var id: UUID
var image: UIImage
}
**/
List($results) { $result in
Image(uiImage: result.image)
.resizable()
.scaledToFit()
} // works fine
ForEach($results) { $result in
Image(uiImage: $result.image)
} // has error
Environment Info
- XCode13.4.1