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

2K
Views
How to change the Picker menu text size in SwiftUI?

I have a Picker of style Menu and I need to change its text size (the blue text), I tried the .font(.largeTitle) modifier but it didn't work.

enum Privacy: String, Identifiable, CaseIterable {
    case open = "Open"
    case closed = "Closed"
    var id: String { self.rawValue }
}

struct ContentView: View {
    @State var selection = Privacy.open
    var body: some View {
        Picker("Privacy", selection: $selection) {
            ForEach(Privacy.allCases) { value in
                Text(value.rawValue)
                    .tag(value)
                    .font(.largeTitle)
            }
        }
        .font(.largeTitle)
        .pickerStyle(.menu)
    }
}

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Remove the .menu style and just wrap it in Menu instead, with a custom label:

Menu {
    Picker(selection: $selection) {
        ForEach(Privacy.allCases) { value in
            Text(value.rawValue)
                .tag(value)
                .font(.largeTitle)
        }
    } label: {}
} label: {
    Text("Privacy")
        .font(.largeTitle)
}
over 4 years ago · Santiago Trujillo Report

0

If someone needs to show selected value as label (instead of static text) in this scenario, the following variant can be used

Tested with Xcode 13.2 / iOS 15.2

demo

Menu {
    Picker(selection: $selection) {
        ForEach(Privacy.allCases) { value in
            Text(value.rawValue)
                .tag(value)
        }
    } label: {}
} label: {
    Text(selection.rawValue)
        .font(.largeTitle)
}.id(selection)
over 4 years ago · Santiago Trujillo Report

0

I found that the Menu { Picker() {} } trick did broken things on Mac (nests the proper menu inside a single item menu). But this slight mod is so far working cleanly across iPhone, iPad, and Mac:

Menu {
    ForEach(RowLabelType.allCases, id: \.self) { type in
        Button {
            todayTabRowLabels = type
        } label: {
            Text(type.displayString)
        }
    }
} label: {
    Text(todayTabRowLabels.displayString)
}
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!