I'm trying to change from one Layout
to another when Dynamic Type Size
changes. I've tried
Sample code:
struct DynamicLayoutExample: View {
@Environment(\.dynamicTypeSize) var dynamicTypeSize
var body: some View {
let layout = dynamicTypeSize <= .medium ?
AnyLayout(HStack()) : AnyLayout(VStack())
layout {
Text("First label")
Text("Second label")
}
}
}
CodePudding user response:
As a work around you can use _HStackLayout()
and _VStackLayout()
if you want to see it working.
Tested on Xcode 14 Beta 3 in iOS 16 simulator