If your minimum deployment target is lower than iOS 16, macOS 11, watchOS 9 or tvOS 16, you may need to use AdaptiveGrid as to support older platforms.
Otherwise, go ahead and use SwiftUI’s built in Grid.
Platforms
iOS 14.0+
macOS 11.0+
tvOS 14.0+
watchOS 7.0+
Getting Started
It’s similar to SwiftUI’s native Grid, so you can quickly gettting started.
If you want to add dividers as row seperators, specify showDivider to true.
AdaptiveGrid(showDivider: true) {
...
}
Note
Currently, Adaptive Grid takes the maximum space horizontally, which is the same with SwiftUI’s built-in Grid with Dividers added, so you may need to specify a width or maxWidth manually to control the size.
Adaptive Grid
An alternative Grid View for old platforms.
If your minimum deployment target is lower than iOS 16, macOS 11, watchOS 9 or tvOS 16, you may need to use
AdaptiveGrid
as to support older platforms.Otherwise, go ahead and use SwiftUI’s built in
Grid
.Platforms
Getting Started
It’s similar to SwiftUI’s native
Grid
, so you can quickly gettting started.You can specify both horizontal and vertical spacing just like how you use the SwiftUI’s native
Grid
view.If you want to add dividers as row seperators, specify
showDivider
totrue
.Note
Currently, Adaptive Grid takes the maximum space horizontally, which is the same with SwiftUI’s built-in
Grid
with Dividers added, so you may need to specify awidth
ormaxWidth
manually to control the size.