All of the examples on the Internet show the following type of code for implementing pickers:
struct MyView: View { var colours = ["Red", "Green", "Blue"] @State private var myColourIndex = 1 @State private var myColour = "Green" var body: some View { VStack { Picker(selection: $myColourIndex, label: Text("Choose a colour")) { ForEach(0 ..< colours.count) { Text(self.colours[$0]) } } } } } This is probably very obvious but my question is how do you set the section based on the string value stored in myColour rather than the index?