Learning with the Xcode 11 Beta 7 but several files error with same error

With the Apple Swifth UI Tutorials - Section 3 Customizing the Row Preview i am getting an error that occurs in every other subsequent part of the exercise.


The error prevents me from seeing the Preview of the code in the viewer.


The error is


Compling failed: no type named 'LandmarkRow_Previews' in module Landmarks



// LandmarkRow.swift

// Landmarks

//

// Created by Richard Baker on 9/3/19.

// Copyright © 2019 Apple. All rights reserved.

//


import SwiftUI


struct LandmarkRow: View {

var landmark: Landmark

var body: some View {

HStack {

landmark.image

.resizeable()

.frame(width: 50, height:50)

Text(landmark.name)

}

}

}


struct LandmarkRow_Previews: PreviewProvider {

static var previews: some View {

Group {

LandmarkRow(landmark: landmarkData[0])

LandmarkRow(landmark: landmarkData[1])

}

.previewLayout (.fixed(width:300, height:70))

}

}


This error shows up in the next section of the Tuturial as well called Create the List of Landmarks.


The code matches what I see displayed on the web site, so I don't really know what is going on.


I am on Catalina 10.15 Beta 7 and on Xcode 11 Beta 7

Replies

This sample code for Landmark is really buggy, or at least not consistent with the present bersion of SwiftUI.


The best is to ignore it until it is stabilized.

I have the same issue. Even I downloaded the sample and compare between "Start point" and "Complete" files.
I copied exactly code but seems doesn't work either.


Better to wait for the final release.

Is the project folder on your Desktop or in a directory on your desktop?
I was getting the same error. Did a command + shift + k, closed the project, and moved it to the root of my home folder. Started back up and it worked fine.
I suspect it has sometime to do with accessing files on the Desktop, a "protected" directory in Catalina.

Make sure you're not running Xcode from your Downloads folder. Seems to cause issues like this for me.

Yeah! It works, thx

The reason is that the build was not correct.


command + shift + k performs a clean build folder.

and option-command + shift + k performs some additional clean up.

Just downloaded latest Catalina 10.15 and Xcode and still got the error. Thanks for the Shift-Command-K tip.


Cheers,


G

Yes, just clean the code, it worked! Thanks

It worked thank you!

It worked for me, thanks