Adding the images to the scene
There are four images we need to add to our scene, which we will add in the following order:
- The background
- The right leg
- The girl
- The left leg
So, let’s get started!
Adding the background
We’ll add the background inside a ZStack
, this will be the first view in the file, and so all subsequent views will be placed on top of this. Here is the code you need:
var body: some View { ZStack { Image("tree").resizable() .frame(width: 550, height: 900) } }
In ZStack
, we call the Image
initializer and pass in the tree
string. Next...