Member-only story

ProgressView in SwiftUI

Gabriel Theodoropoulos
6 min readMay 7, 2021

--

Image by ross ruby from Pixabay

Today in this post I’m going to show you how to use the ProgressView in SwiftUI. A native view that was introduced in WWDC 2020 and makes it amazingly easy to indicate the progress of tasks that take time to complete.

There are two kind of tasks to report progress for; those for which we can determine when they are going to complete, and those with unpredictable finishing time. For that reason they exist two types of progress view respectively; the linear and the indeterminate. The first one is a bar that is getting filled according to the task’s completion amount, while the second is by default a circular activity indicator spinning around indefinitely until the task is over.

We are going to see both in this post, starting with the indeterminate type of progress view. The demonstration will not stop in the system provided views only; I will also show you how to create custom progress view styles in order to come up with custom and unique progress views.

The indeterminate progress view

The simplest way to present an indeterminate progress view is this:

ProgressView()

The above will display the default spinner that we are all familiar with. A message can easily go along with the spinner if we simply provide it as an argument to the ProgressView:

--

--

Gabriel Theodoropoulos
Gabriel Theodoropoulos

Written by Gabriel Theodoropoulos

An iOS & macOS app maker writing code in Swift. Author of countless programming tutorials. Content creator. https://serialcoder.dev

No responses yet