NEW: Learn to build the incredible iOS 15 Weather app today! >>

swiftui - How do you specify a font modifier within a Picker

Forums > SwiftUI


Very much a swiftui noob; Can anyone direct me to how to properly apply a .font modifier on the text within a picker? e.g. in this sample code, why are the picker selections not rendered as the text above it?

struct ContentView: View {
    @State var selection: String = "A"

    var body: some View {
        VStack {

                   selection: $selection,
                   content: {


I am seeing that application of a PickerStyle only only partially helpful.

.pickerStyle(MenuPickerStyle())   // fomatting ignored...

.pickerStyle(WheelPickerStyle())  // formatting works...

Can MenuPickerStyle() be made to format the Text view?


You could try creating an extension for Picker and / or Text.

Here is an example for Text to give you some ideas - Text extension.



Thank you @Greenamberred, while this didn't work here, I can see how useful extension's could be.


Hacking with Swift is sponsored by Sentry

SPONSORED With Sentry’s error and performance monitoring for iOS, you see mobile vitals that actually matter, can solve any latency issues quickly, and learn how each release is performing over time.

Learn More

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

Unknown user

You are not logged in

Log in or create account

Link copied to your pasteboard.