Created
June 27, 2021 17:44
Revisions
-
atrinh0 created this gist
Jun 27, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ import SwiftUI struct ContentView: View { let options: [String] = ["ascending", "descending", "highest", "lowest"] @State private var selectedOption = "ascending" var body: some View { NavigationView { VStack { Text("Image label") Picker(selection: $selectedOption, label: Image(systemName: "line.horizontal.3.decrease")) { ForEach(options, id: \.self) { Text($0) } } .pickerStyle(MenuPickerStyle()) Text("Text label") Picker(selection: $selectedOption, label: Text("sort")) { ForEach(options, id: \.self) { Text($0) } } .pickerStyle(MenuPickerStyle()) Text("Leading string") Picker("sort", selection: $selectedOption) { ForEach(options, id: \.self) { Text($0) } } .pickerStyle(MenuPickerStyle()) Spacer() } .navigationBarItems(leading: Picker(selection: $selectedOption, label: Image(systemName: "line.horizontal.3.decrease")) { ForEach(options, id: \.self) { Text($0) } } .pickerStyle(MenuPickerStyle()) , trailing: Picker(selection: $selectedOption, label: Text("sort")) { ForEach(options, id: \.self) { Text($0) } } .pickerStyle(MenuPickerStyle()) ) } .navigationViewStyle(StackNavigationViewStyle()) } }