Xcode gives the error message “Ambiguous use of ‘Preview'” for the following code:
import SwiftUI
struct TileDetailView: View {
@Binding var tile: Tile // This is a custom object
@Binding var isShowingTileDetail: Bool
var body: some View {
Text("This is a tile.")
}
}
#Preview {
let bindingVar = Binding.constant(false)
let aTile = AMClass(name: "A Tile")
let bindingTile = Binding<Tile>(
get: { aTile }
)
return TileDetailView(aTile: bindingTile, isShowingClassDetail: bindingVar)
}
Please feel free to point out problems with the above code. Thank you.




