Member-only story
How To Make a Simple Countdown Timer with SwiftUI
Step-by-step instructions on how to build using the SwiftUI framework
Yesterday, Apple launched a new framework called SwiftUI that allow us to make apps interface in a new, 100% swifty way. I performed some experimentations with it and in this piece, will show you how to make a countdown timer.
Pre-Requirements
To start with SwiftUI, visit https://developer.apple.com/download/ and download the last build of Xcode 11 and macOS Catalina 10.15. SwiftUI also works with Xcode on Mojave but the preview won’t work. Also, it is important to note that SwiftUI framework is only available on iOS 13, macOS 10.15, watchOS 6 and iPadOS 13.
Creating a SwiftUI project
Create a new iOS project with Xcode 11 and be sure to check the SwiftUI box:
Now that you created the project, take a look at the ContentView.swift file and the body variable implementation, this is where you will implement the view in SwiftUI. It should look like this:
var body: some View {