swiftui-layout

SwiftUI grid with column that fits content?

安稳与你 提交于 2021-01-28 17:02:33
问题 Is this layout possible with SwiftUI? I want the first column to wrap the size of the labels, so in this case it will be just big enough to show "Bigger Label:". Then give the rest of the space to the second column. This layout is pretty simple with auto layout. SwiftUI 2020 has LazyVGrid but the only ways I see to set the column sizes use hardcoded numbers. Do they not understand what a problem causes with multiple languages and user-adjustable font sizes? 回答1: It is not so complex if to

How do I change the fixed size of a Lazy Grid GridItem in response to Dynamic Text size changes?

老子叫甜甜 提交于 2021-01-28 06:14:05
问题 The code below is using a LazyVGrid to implement layout of my controls such that everything lines up like this: Particularly, the sliders' ends all align and the symbols are centre-aligned to each other. I have worked out how to size the GridItems for the symbol and the numeric readout such that they are the 'right size' for their contents — something neither flexible nor adaptive GridItems will do — while accounting for Dynamic Type . In testing, this works really well so long as the user