SwiftUI Tutorial Application Alleged Incompatibility with macOS

Hello, new to Xcode and SwiftUI.

Have Mac Pro M1 running macOS version 12.6 (Monterey) and Xcode version 14.0, which I believe at the time of posting are the latest stable versions.

Using Xcode, I was following the developer.apple.com SwiftUI Landmarks tutorial, which is in three parts. The first part, Creating and Combining Views, ran successfully.

The second part, Building Lists and Navigation, began alright, but when I reached the point of coding the view LandmarkRow.swift (struct definition for first row), "Landmarks quit unexpectedly" then alleged "You can't use this version of the application "Landmarks" with this version of macOS".

Can anyone advise whether that error message is true or whether it's masking some other problem, please ?

I took a look at the tutorial and I saw nothing in it that requires macOS 13.

Can you clarify what you were doing when you got the error messages? Did the errors occur when you were typing code or when you build the project?

At that point in the tutorial, it says the previews won't work because of the new stuff you typed. The next section in the tutorial fixes the problem.

Thanks for taking a look.

It was Section 2, Step 4, having typed in the 'struct LandmarkRow_Previews ...' code that the problem occurred. I have re-opened the project and selected LandmarkRow view. The preview canvas states 'Preview paused'. Clicking the refresh arrow again throws the error "Landmarks quit unexpectedly". Upon clicking 'Reopen', get "You can't use this version of the application "Landmarks" with this version of macOS".

I think I'd better try the tutorial again from scratch.

You don't need to restart the tutorial.

The SwiftUI previews are flaky. Try turning off the preview canvas when entering the code for the preview and turning it back on when you're done typing the code.

If you don't know how to turn off the preview canvas, read the following:

https://swiftdevjournal.github.io/intro-swiftui-guide/Previews

If you are still having problems with the canvas, you can turn off the preview canvas and run the project in the Simulator. The Simulator takes a long time to launch the first time you run the project, but after that, building and running the project isn't much slower than the preview canvas.

I am redoing the tutorial, and have found issues with the code. In fact, I've had to change a few things. Is this due to different versions of Xcode? for example... the preview is specified in the tutorial as :

#Preview { Group { LandmarkRow(landmark: landmarks[0]) LandmarkRow(landmark: landmarks[1]) } }

When I create a new view, the preview is automatically provided as:

struct LandmarkRow_Previews: PreviewProvider { static var previews: some View { LandmarkRow(landmark: landmarks[0])

}

}

Am I missing something, or is it another version of the code, and then certain things don't work anymore?

SwiftUI Tutorial Application Alleged Incompatibility with macOS
 
 
Q