Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

265
Views
SwiftUI Picker greyed out in a List

Does anyone have a fix for this? I have a Picker in my List that doesn't respond to any user input and is greyed out, but if I move it out of the List and into a VStack it functions normally.

The majority of answers I've found to this question all say that the Picker needs to be in a Form to work (which I don't understand since it works fine in a VStack), or that its a bug in which it only works on a physical device, which I've also tested on and gotten the same result.

I'll provide a screenshot as well as the code I'm using below

Picker in simulator

import SwiftUI
struct SettingsView: View {
    
@Binding var age : Int

var body: some View {
        VStack(alignment: .leading){
                List{  
                        Picker("Your age", selection: $age) {
                                ForEach(1...100, id: \.self) { number in
                                    Text("\(number)")
                                           }
                                }
                    }
        }
}
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You must embed your List inside a NavigationView, so you can actually "navigate" from "Your age" to the list of Ints.

Just add one additional layer, as shown below:

    var body: some View {
        VStack(alignment: .leading){
            NavigationView {   // This is needed to navigate to the ForEach
                List {
                    Picker("Your age", selection: $age) {
                        ForEach(1..<101) { number in
                            Text("\(number)")
                        }
                    }
                }
            }
        }
    }
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!