Learn Courses My Dashboard

Lesson 4; my preview does not stack properly

When I try to use Vstack, it doesn’t show up on my preview. Rather, the only way I can see the “Hello!” image is because Xcode generates a second preview phone underneath the one I have set up. Any thoughts?

And I realize that it currently says ZStack. Same issue applies.

Hi Luke,

Welcome to the Code Crew community.

Pretty simple solution:

  • See the closing brace after .aspectRatio(ContentMode: .fit) on line 17?
  • place your cursor just before the brace and press return so that it is on a new line.
  • Select all your code by pressing Command + A then press Control + i
  • You should now see that Text(“Hello”) is not within the ZStack set of braces.
  • Select it and press Command + X (cut) then move your cursor to just after .aspectRatio(ContentMode: .fit) and press return to make a new line, then paste that code on that line - Command + V (paste)
    That should solve the problem.