Last active
November 5, 2023 16:50
-
-
Save jamesporter/81ff12b767b7cbaee88c7fd0944aeead to your computer and use it in GitHub Desktop.
Revisions
-
jamesporter revised this gist
Nov 5, 2023 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,10 @@ // 1. Set up adapative items (repeat, with min/max width), then add spacing as second argument to GridItem: var columns = [GridItem(.adaptive(minimum: 240, maximum: 420), spacing: spacing)] var body: some View { VStack { ScrollView { LazyVGrid(columns: columns, spacing: spacing) { // 4. also add spacing here (between rows) ForEach(document.state.cards) { card in // 2. Item, then with heights that take full width + some fixed height: @@ -14,5 +14,5 @@ var columns = [GridItem(.adaptive(minimum: 240, maximum: 420), spacing: 8)] .background(.white) .cornerRadius(8) } }.padding(spacing) // 3. Add paddding OUTSIDE the grid -
jamesporter created this gist
Apr 25, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ // 1. Set up adapative items (repeat, with min/max width), then add spacing as second argument to GridItem: var columns = [GridItem(.adaptive(minimum: 240, maximum: 420), spacing: 8)] var body: some View { VStack { ScrollView { LazyVGrid(columns: columns) { ForEach(document.state.cards) { card in // 2. Item, then with heights that take full width + some fixed height: .frame(maxWidth: .infinity) .frame(height: 480) .padding() .background(.white) .cornerRadius(8) } }.padding() // 3. Add paddding OUTSIDE the grid