Reading time: 7 min

This recipe shows how to add custom row swipe actions to a SwiftUI List, supporting multiple custom buttons on either side, as well as full swipe functionality. The end result looks like this:

preview

The solution depends on which SwiftUI version you have to support:

  1. SwiftUI 3 (iOS 15, macOS 12...

Continue Reading...

Reading time: 1 min

This recipe shows how to change or remove row padding (insets) in SwiftUI List. The end result looks like this:

preview

To make this happen, use the listRowInsets modifier on the List content view. Don't place the modifier on the List itself or its superviews, or else it won't work.

@State p...

Continue Reading...

Reading time: 1 min

This recipe shows how to change row and header height in SwiftUI List. The end result looks like this:

preview

OK, the recipe is quite simple. You use EnvironmentValue named defaultMinListRowHeight to set, well, default minimum list row height :D. Similarly, you can dictate the height of section h...

Continue Reading...

Reading time: 1 min

This recipe shows how to display a grouped list in SwiftUI. A grouped list contains sections, comprised of zero or more rows, plus an optional header and footer.

The end result will look like this:

grouped-insets

OK, so the formula is quite simple:

  1. Pass Sections as your List's items.
  2. Specify...

Continue Reading...

Reading time: 2 min

This recipe shows how to implement a custom separator/divider in any SwiftUI list feeded by a ForEach - like VStack, LazyVStack, HStack, LazyHStack, etc. The end result looks like this:

ezgif-2-c66ddfeec0a2

The gist of the recipe is to implement a custom ForEach that inserts separators between items. It...

Continue Reading...