Selaa lähdekoodia

Check os to set pickerStyle

Matthew Mathias 3 vuotta sitten
vanhempi
sitoutus
69b194fabc

+ 6 - 4
Samples/Swift/DaysUntilBirthday/Shared/Views/SignInView.swift

@@ -32,7 +32,7 @@ struct SignInView: View {
             HStack {
             HStack {
               Text("Button style:")
               Text("Button style:")
                 .padding(.leading)
                 .padding(.leading)
-              Picker("Select button style", selection: $vm.style) {
+              Picker("", selection: $vm.style) {
                 ForEach(GoogleSignInButtonStyle.allCases) { style in
                 ForEach(GoogleSignInButtonStyle.allCases) { style in
                   Text(style.rawValue.capitalized)
                   Text(style.rawValue.capitalized)
                     .tag(GoogleSignInButtonStyle(rawValue: style.rawValue)!)
                     .tag(GoogleSignInButtonStyle(rawValue: style.rawValue)!)
@@ -43,7 +43,7 @@ struct SignInView: View {
             HStack {
             HStack {
               Text("Button color:")
               Text("Button color:")
                 .padding(.leading)
                 .padding(.leading)
-              Picker("Select button color", selection: $vm.scheme) {
+              Picker("", selection: $vm.scheme) {
                 ForEach(GoogleSignInButtonColorScheme.allCases) { scheme in
                 ForEach(GoogleSignInButtonColorScheme.allCases) { scheme in
                   Text(scheme.rawValue.capitalized)
                   Text(scheme.rawValue.capitalized)
                     .tag(GoogleSignInButtonColorScheme(rawValue: scheme.rawValue)!)
                     .tag(GoogleSignInButtonColorScheme(rawValue: scheme.rawValue)!)
@@ -54,7 +54,7 @@ struct SignInView: View {
             HStack {
             HStack {
               Text("Button state:")
               Text("Button state:")
                 .padding(.leading)
                 .padding(.leading)
-              Picker("Select button state", selection: $vm.state) {
+              Picker("", selection: $vm.state) {
                 ForEach(GoogleSignInButtonState.allCases) { state in
                 ForEach(GoogleSignInButtonState.allCases) { state in
                   Text(state.rawValue.capitalized)
                   Text(state.rawValue.capitalized)
                     .tag(GoogleSignInButtonState(rawValue: state.rawValue)!)
                     .tag(GoogleSignInButtonState(rawValue: state.rawValue)!)
@@ -63,7 +63,9 @@ struct SignInView: View {
               Spacer()
               Spacer()
             }
             }
           }
           }
-          .pickerStyle(.automatic)
+          #if os(iOS)
+            .pickerStyle(.automatic)
+          #endif
         }
         }
       }
       }
       Spacer()
       Spacer()