13 Replies
      Latest reply on Jan 22, 2020 1:18 PM by Matinsaurralde
      mwmv Level 1 Level 1 (0 points)

        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

        • Re: Xcode 11 beta preview not showing (building)
          Pinelapples Level 1 Level 1 (0 points)

          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.

            • Re: Xcode 11 beta preview not showing (building)
              DevHelp Level 1 Level 1 (0 points)

              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.

            • Re: Xcode 11 beta preview not showing (building)
              jorgea380 Level 1 Level 1 (0 points)

              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.

                • Re: Xcode 11 beta preview not showing (building)
                  bath-gorilla Level 1 Level 1 (0 points)

                  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.

                    • Re: Xcode 11 beta preview not showing (building)
                      djecaveman Level 1 Level 1 (0 points)

                      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!

                  • Re: Xcode 11 beta preview not showing (building)
                    shfyr Level 1 Level 1 (0 points)

                    Got the same problem.

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

                    • Re: Xcode 11 beta preview not showing (building)
                      jasonkidd Level 1 Level 1 (0 points)

                      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

                      • Re: Xcode 11 beta preview not showing (building)
                        justinct Level 1 Level 1 (0 points)

                        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.

                        • Re: Xcode 11 beta preview not showing (building)
                          jefffromcardiff Level 1 Level 1 (0 points)

                          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.

                          • Re: Xcode 11 beta preview not showing (building)
                            JacobMcD Level 1 Level 1 (0 points)

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

                            • Re: Xcode 11 beta preview not showing (building)
                              cmsund Level 1 Level 1 (0 points)

                              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.

                              • Re: Xcode 11 beta preview not showing (building)
                                Matinsaurralde Level 1 Level 1 (0 points)

                                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!