https://developer.apple.com/documentation/swiftui/view/controlsize(_:)
Even the code on apple’s official document site is not working
struct ControlSize: View {
var body: some View {
VStack {
MyControls(label: "Mini")
.controlSize(.mini)
MyControls(label: "Small")
.controlSize(.small)
MyControls(label: "Regular")
.controlSize(.regular)
}
.padding()
.frame(width: 450)
.border(Color.gray)
}
}
struct MyControls: View {
var label: String
@State private var value = 3.0
@State private var selected = 1
var body: some View {
HStack {
Text(label + ":")
Picker("Selection", selection: $selected) {
Text("option 1").tag(1)
Text("option 2").tag(2)
Text("option 3").tag(3)
}
Slider(value: $value, in: 1...10)
Button("OK") { }
}
}
}
Please tell me, is this a bug or am i missing something, please don’t provide workaround i want to know the actual solution if it’s not a bug by apple.
Devices checked:
- iOS (16+) iPhoneX, real device.
- iOS (17+) iPhone 15, simulator.
- iOS (17+) iPad (10th generation), simulator.
Xcode Version:
- Version 15.3