swiftui-picker

How to get SwiftUI Picker in subview working? (Greyed out)

守給你的承諾、 提交于 2021-01-29 21:31:02
问题 I'm working on a SwiftUI project and am having trouble getting a picker to work correctly. I've got a hierarchy of views split into multiple files with the initial view wrapping everything in a NavigationView. Looks something like this: MainFile (TabView -> NavigationView) - ListPage (NavigationLink) -- DetailHostPage (Group.EditButton) if editing --- DetailViewPage else --- DetailEditPage (picker in a form) The picker that I have in the DetailEditPage does not let me change it's value,

Hiding Picker's focus border on watchOS in SwiftUI

天涯浪子 提交于 2021-01-28 11:18:32
问题 I need to use a Picker view but I don't see any options to hide the green focus border. Code: @State private var selectedIndex = 0 var values: [String] = (0 ... 12).map { String($0) } var body: some View { Picker(selection: $selectedIndex, label: Text("")) { ForEach(0 ..< values.count) { Text(values[$0]) } } .labelsHidden() } 回答1: The following extension puts a black overlay over the picker border. Result Code extension Picker { func focusBorderHidden() -> some View { let isWatchOS7: Bool = {

Why does my SwiftUI page title change when a picker option is selected?

不想你离开。 提交于 2020-07-22 06:25:29
问题 struct SettingsView: View { let settings: [Setting] = [ Setting(name: "Aperture Increments", options: ["1/3", "1/2", "1"]), Setting(name: "Shutter Speed Increments", options: ["1/3", "1/2", "1"]), Setting(name: "ISO Increments", options: ["1/3", "1/2", "1"]) ] var body: some View { NavigationView { Form { ForEach(self.settings, id: \.name) { setting in SettingDetailView(setting: setting) } } .navigationBarTitle("Settings", displayMode: .inline) } .navigationViewStyle(StackNavigationViewStyle(