In SwiftUI, How to increase Font Size/Style of a Picker?

Is there a way to change the Font Size or Style inside a Picker?? In SwiftUI.

Thanks

Answered by RayOV in 707856022

I found this:

To change the attributes of a segmented picker, you can add this init to your View struct:

   init() {
    //This changes the "thumb" that selects between items
    UISegmentedControl.appearance().selectedSegmentTintColor = .red
     
    //This changes the color for the whole "bar" background
    UISegmentedControl.appearance().backgroundColor = .purple

     
    //This will change the font size
    UISegmentedControl.appearance().setTitleTextAttributes([.font : UIFont.preferredFont(forTextStyle: .headline)], for: .highlighted)
    UISegmentedControl.appearance().setTitleTextAttributes([.font : UIFont.preferredFont(forTextStyle: .largeTitle)], for: .normal)
     
    //these lines change the text color for various states
    UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor : UIColor.cyan], for: .highlighted)
    UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor : UIColor.green], for: .selected)
  }

In your ForEach set the font size & style for the Text view entries

Accepted Answer

I found this:

To change the attributes of a segmented picker, you can add this init to your View struct:

   init() {
    //This changes the "thumb" that selects between items
    UISegmentedControl.appearance().selectedSegmentTintColor = .red
     
    //This changes the color for the whole "bar" background
    UISegmentedControl.appearance().backgroundColor = .purple

     
    //This will change the font size
    UISegmentedControl.appearance().setTitleTextAttributes([.font : UIFont.preferredFont(forTextStyle: .headline)], for: .highlighted)
    UISegmentedControl.appearance().setTitleTextAttributes([.font : UIFont.preferredFont(forTextStyle: .largeTitle)], for: .normal)
     
    //these lines change the text color for various states
    UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor : UIColor.cyan], for: .highlighted)
    UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor : UIColor.green], for: .selected)
  }

In SwiftUI, How to increase Font Size/Style of a Picker?
 
 
Q