Newbie: Stuck with SwiftUI tutorials

I'm trying to do the same with the tutorials, but I don't know why it always gives me this wrong result. However, when I install Apple's code, it runs well.

I don't know why.

Have you guys encountered this problem before?"?

This tutorial: Building lists and navigation | Apple Developer Documentation

Can you check your "LandmarkList.swift" file is included in the LandmarksUITests target?

1 Like


Where do I put it on?

Thank you for supporting!

  1. Select the file in the navigator (on the left-hand side).
  2. In the File Inspector pane (on the right-hand side), check the Target Membership section.
  3. Check the box next to your LandmarksUITests target to include the file.
1 Like

amz, after check "LandmarkUITest" in all files, it runs now. Thank you.

So the Target Membership requires us check the box "...UITests" to run test? Is it true?

1 Like

Yes, in Xcode, each file can be associated with one or more targets through the “Target Membership” section. For your tests to have access to the necessary classes, you must check the box for the test targets you want the file to be a part of.

You can also specify the targets at the moment you create the file, like this:

1 Like

Gotta! Thank you so much!