Reading time: 3 min

This recipe shows how to customize a Progress view by implementing a custom ProgressViewStyle. You'll implement a circular progress bar that supports both definite and indefinite progress. The end result will look like this:

Preview

Progress view and ProgressViewStyle were introduced in SwiftU...

Continue Reading...

Reading time: 1 min

Here's a simple recipe to help you draw Arc shapes in SwiftUI. For some reason, arcs still aren't a part of the standard Shape package, but fortunately, wrapping them isn't too difficult. The end result looks like this:

Screenshot%202021-08-11%20at%2012.48.33

As you can see, the arcs can be stroked and filled just like any other S...

Continue Reading...

Reading time: 2 min

Here at SwiftUIRecipes.com, we're proud to announce the SwiftUI Recipes Companion app!

This FREE app allows you to view community-sourced recipes and includes an XCode Source Editor extension, allowing you to insert the recipe code straight into your own!

You can preview its content and...

Continue Reading...

Reading time: 2 min

This recipe shows how to show multiple Alerts, ActionSheets or custom dialogs, without tying them to multiple views. The end result looks like this:

ezgif-3-31b97e7c1ad8

The usual way of using multiple views has its shortcomings, as it:

  • Forces you to have at least as many views as distinct modals you wish...

Continue Reading...

Reading time: 1 min

For whatever reason, stroking (i.e drawing a border) and filling a SwiftUI Shape at the same time is difficult and unintuitive. Shape has methods for both, stroke and fill, respectively, but they both return some View, meaning you can't chain them.

Say you want to do the following:

Screenshot%202021-07-21%20at%2021.02.45

T...

Continue Reading...