Posts

Post marked as solved
2 Replies
Yeah sadly you can't use an Optional value with a Picker in the same simple way you can normally do for Enum types. Instead, you need must tag each item casted as an Optional value. Here's an example from this SO answer to the question: Picker for optional data type in SwiftUI?: struct FruitView: View { @State private var fruit: Fruit? var body: some View { Picker(selection: $fruit, label: Text("Fruit")) { Text("No fruit").tag(nil as Fruit?) ForEach(Fruit.allCases) { fruit in Text(fruit.rawValue).tag(fruit as Fruit?) } } } }
Post not yet marked as solved
3 Replies
For me this happened because I moved my Xcode project into a file path that included a folder with an apostrophe in the name. Renaming the folder to remove the apostrophe fixed it so that the warnings now appear in the Xcode toolbar.