Assembling the elevator using images and the GeometryReader view
The next step is to use some of the images from the Assets catalog and make an elevator.
We’ll start by adding the inside part of the elevator, which we’ll do by adding the following code inside the body
property:
ZStack { GeometryReader { geo in } }
First, we have ZStack
to hold all the views that will follow, and a GeometryReader
view.
The GeometryReader
view is a container view that defines its content as a function of its own size and coordinate space. It’s a little bit like the other containers that we have used, such as VStack
or HStack
, but the difference is that GeometryReader
has more flexibility because of its proxy parameter, the geo
constant (which you can name whatever you want).
This proxy will contain information about the...