Picker for optional data type in SwiftUI?
The tag must match the exact data type as the binding is wrapping. In this case the data type provided to tag is Fruit but the data type of $fruit.wrappedValue is Fruit?. You can fix this by casting the datatype in the tag method: struct FruitView: View { @State private var fruit: Fruit? var body: … Read more