Xcode 11 beta preview not showing (building)

I am following the SwiftUI Tutorial from developer.apple.com site and when I try to preview some files that I created in th project it shows me an error message "Failed to build LandmarkList.swift" followed by an info icon saying "Compiling failed: no type named "LandmarkList_Previews" in module Landmarks". When I hit Try again button it keeps not showing and just giving the same error message.


I have already:

- deleted the Xcode 10 version that I had installed.

-closed and openned Xcode 11 beta


Im running on MacOS Catalina Beta version 10.15.


Somebody please

Replies

Also having this issue. I tried moving all the files to the root user directory, which solved a similar problem for the LandmarkRow file, but it didn't work in this case.

Same. It appears that XCode doesn't recognize that the .swift file is part of the Landmarks project. So for instance if you try to make a variable of type Landmark, and then right-click and "Jump to Definition" XCode just flashes a question mark. Whereas in LandmarkRow.swift, the same task will actually open the Landmark.swift file that defines a Landmark. Frustrating - how can we add a SwiftUI file to our project so that XCode recognizes the new file is part of an existing project?


UPDATE: playing around more, it isn't adding the file, but rather its that Preview / Canvas system doesn't recognize any new Views as being part of the Landmarks module. For instance, I add a new SwiftUI file, edit nothing, and click Resume in the Canvas. It should display hello world, but it gives the error:


Compiling failed: no type named 'Test_Previews' in module 'Landmarks'


Whereas previously this worked.

Yeah. Itried that too. But it gives the same error.

What seem to work for me is reboot the Macbook, it will work for some time until it crashes again and i need to reboot again.

Thanks, I wouldn't have tried that if I hadn't seen your post but incredibly it worked for me too.


I have to say, the state of xCode 11 alongside the factual inaccuracy of these tutiorials doesn't exactly inspire confidence.


I'm a beginner and on more than one occasion I have spent an hour or more trying to troubleshoot a problem that was either an inaccuracy in the tutorials or xCode just being buggy where a restart of the app, or in this case, the whole OS fixed the issue.


Very poor.

I am going through the same tutorial and am running into the same problem. I'm running macOS 10.15 (beta) and XCode 11.1 (beta). When I create the SwiftUI View LandmarkList, the preview returns an error and fails to load. But the preview still works for the previously created files (i.e. LandmarkRow).


I have tried rebooting but that didn't resolve the issue. If you were able to get this working, your advice would be greatly appreciated!

Got the same problem.

I removed the project from "Downloads" folder to the root of my home folder. It helped.

I'm having the same issue. It resolved once when I moved my project folder out of my downloads, but it started appearing again.


https://imgur.com/a/kIDQjYr

Does anyone have any further updates on this?


I am experiencing exactly the same issue on XCode 11.1. Any new swiftui view added to the Landmarks project fails to preview in the canvas. I had reached Section 4 Step 1 of the Building Lists and Navigation tutorial without any issues.


I can add new swiftui views to other projects, including the Landmarks one built from scratch in the previous tutorials. So it seems like there is something wrong with the StartingPoint project provided in the tutorial downloads.

Same issue. It's really bizarre and is making me lose confidence in SwiftUI with Xcode 11. It's like IBDesignables all over again. The preview doesn't work for any files you add to the starting project; it makes going through the tutorial impossible. There's no code completion and the preview never works.

Same problem. Makes the tutorials completely useless. Does anyone know who this should be reported to?

A workaround is to create a new project and drag in all the files from the original Landmarks project, then proceed through whatever tutorial(s) you are working through. The preview works in this case. Not ideal, but a workaround nonetheless.

I had the same issue not only with the LandmarkList but also with the LandmarkRow. I'd solved it both times just by copying the complete project folder and pasting it in a different location, then reopening the project from that new location. Hope it works for you!

Its a shame that Apple still has these kind of issues with its own tutorials, it's frustrating for those new to xcode and SwiftUi like me!

Hello I have the same issue here.


I am using a 2012 macbook pro - witth all the current versions of osx and xcode etc.

I have two account set up on my MBP. I have been using Xcode on my main account and experienced the Preview failure in Xcode.


I also have a Macmini 2012 all up to date and there is no problem with Xcode Preview sor far.


I opened my second user account on my MBp 2012 and ran Xcode from that account and all is fine - preview works ok.


So it looks the hardware is ok and the OS and Xcode is ok. But for some reason my Main user account can fnd the necssary links to show the preview.


I would suggest, as a work round, creating an addition user account and run Xcode from there and cheeck if that does the trick for you.


(I was thinking of uninstalling xcode and then removing all the associated xcode files and then reinstalling xcode - but this work round will be ok for me).

Regards

K

By doing the below steps it solved the problem:


1. Close the project

2. Delete derived data

3. Open & run the project again


It solved my problem