Is there any way to change the height of segmented controller in SwiftUI or it can be achieved with only creating custom segmented controller? I tried .frame(height) but nothing has changed. I need to increase the height of segmented controller.
@State private var userType = 0
init() {
UISegmentedControl.appearance().selectedSegmentTintColor = .white
UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.blue], for: .selected)
UISegmentedControl.appearance().setTitleTextAttributes([.foregroundColor: UIColor.lightGray], for: .normal)
}
var body: some View {
VStack {
HStack {
Picker("Choose user type", selection: $userType) {
Text("User")
.tag(0)
Text("Administrator")
.tag(1)
}
.pickerStyle(.segmented)
.frame(height: 40)
.padding(.horizontal, 16)
}
}}