Reading time: 2 min

This recipe shows how to implement a timeline list in SwiftUI. Timeline list has a line, usually on the side, that connects rows / cells tied to the same date. The end result looks like this:

Screenshot%202021-11-18%20at%2013.38.17

The example list in this recipe deals with a simple structure that represents an appointment, defi...

Continue Reading...

Reading time: 2 min

This recipe shows how to remove / hide list separator in SwiftUI. This is tricky because each SwiftUI version has its own solution. The end result looks like this:

Simulator%20Screen%20Shot%20-%20iPhone%20SE%20%282nd%20generation%29%20-%202021-11-20%20at%2021.19.12

This recipe will first show the solutions for each SwiftUI version and then present a custom component that works on any vers...

Continue Reading...

Reading time: 1 min

This recipe shows how to add a SwiftUI List with alternating row colors. The end result looks like this:

preview_list

The tricks is to wrap an array of data in an indexed ForEach nested within a List and use the index to set different listRowBackground:

struct AlternatingRowsList...

Continue Reading...

Reading time: 1 min

This recipe shows how to style the progress indicator while using the refreshable on SwiftUI List. The end result looks like this:

preview

This recipe works with the refreshable modifier, which is only available in SwiftUI 3 (iOS 15, macOS 12). If you're interested in custom refresh indicators...

Continue Reading...

Reading time: 1 min

This recipe shows how to add disclosure indicator to your SwiftUI List rows. The end result looks like this:

preview

The disclosure indicator is added automatically whenever your list row contains a NavigationLink, but sometimes you wish render the indicator and have a custom action when the row is...

Continue Reading...