Group Group Group Group Group Group Group Group Group

SwiftUI: Getting Started | raywenderlich.com

Spot on!

Makes it a lot easier to keep playing :smiling_imp:

Hi @audrey, I’ve noticed that in your example the main VStack appears to be stretched to a full height.
But when I’ve run my own code or tried to run the finished example the VStack takes a portion of the screen’s height.
I haven’t found any solution online unfortunately, do you have any idea?

Xcode Version 11.0 (11A419c)

hi Oron! try adding Spacer():

var body: some View {
  VStack {
    Text("Hello World")
    Spacer()
    Text("Hello World")
    Spacer()
    Text("Hello World")
  }
}

Or, do you mean that my RGBullsEye code doesn’t cover the screen?

Hi, thanks for your response Audrey,
I was talking about RGBullsEye, and I well know the Spacer but I don’t think it’s the solution here.
Since in your example it seems that the Rectangle takes over the entire remaining height of the screen but it just don’t happen, not in the finished example and not when I try to code it myself.

I’ve just downloaded the project from the tutorial page and opened it in Xcode 11.1 on Catalina:

32

The problem might be with your installation of Xcode? Try restarting Xcode or Mac, or reinstall Xcode. Delete any earlier versions of Xcode, too.

Updating Xcode did resolve the issue, thanks!

1 Like


hello @audrey! Thank you so much for the tutorial
Maybe you can help me solving my SwiftUI problem, can’t find the answer: when I’m starting preview, for some reason I can’t change anything, I can only select the window, but can’t work with the instructor (so that I can make changes only using code). What can be the problem?
Thank you in advance!

hi Julia! I think your auto-correct did something, and the word turned into “instructor”

do you mean you want to do something like this?

38

I only recently realised that Command-click doesn’t work for everyone. Some people have that shortcut set to “Jump to definition”. If that’s happening to you, then use Control-Command-click instead.

I agree with anm​8tr that the tutorial becomes confusing here. Up to " The new VStack will contain three sliders, and there will be a button between the color blocks and the sliders." it is clear. After that, “Now, practice your new SwiftUI-fu skills to start filling in the color blocks”. What color blocks? There is no context given around the code. What is the screen supposed to look like when finished this step?

hi Victor! I’ve added a screenshot of the finished UI, just before you start outlining the view. Hope this helps!

It’s clear with the downloaded resources, but it could be more clear if you included context. To illustrate what I mean take a look at the part of the tutorial where you said, “Name the ExtractedView ColorSlider , then add these lines at the top, before the body closure:”. The previous time the body closure was mentioned, it referred to the closer in a different class. A newb might think you meant that same place, which, of course, doesn’t work. If your sample code included context, and by that, I mean some lines surrounding what is being added, that would serve to clarify which body you were referring to. Experienced developers would have no issue with this, but newbs, who are probably the main target of these tutorials, would really benefit from the context, in my opinion.

thanks Victor! I wrote this article during WWDC, so the expected audience was early-adopters who were willing to grapple with Xcode and macOS betas. I’ve updated it now to be more newbie-friendly.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!