Adding the variables and a winter background
Let’s get started and create a new SwiftUI project – I have called it Breathing Flower
.
Next, go ahead and download the assets for this project. The images are bouquet
, petal
, smoke
, snow
, and winterNight
. After you download them, drop the images into the Assets catalog.
We now have the pictures we need loaded into the project. So, let’s start in ContentView
and add the variables we need to make this flower come alive:
import SwiftUI struct ContentView: View { @State private var petal = false @State private var breatheInLabel = true @State private var breatheOutLabel = false @State private var offsetBreath = false @State private var diffuseBreath = false @State private var breatheTheBouquet = false
You should be familiar with the process of creating animating variables...