Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

2K
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda