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: 4 min

This recipe shows how to implement a radial /circular / arc menu in SwiftUI. A radial menu positions its elements on an arc at a set distance from an anchor view. It is also commonly used in conjunction with a floating action button. The end result looks like this:

preview

In this recipe, the radi...

Continue Reading...

Reading time: 1 min

This recipe shows how to implement a floating action button (FAB) in SwiftUI. This is a simple component, common in Android apps, that sits in the bottom-right corner of the screen, floating above the rest of the content. The end result looks like this:

preview

The recipe goes as follows:

  • The FAB...

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: 3 min

This recipe shows how to use specify SwiftUI Colors with hex values, either hexadecimal numbers or strings. The end result can look like this:

preview

To make this work, you have to add two extensions to your codebase.

The first one allows you to specify a hex color from an Int, which you can conv...

Continue Reading...