When browsing the new SwiftUI Tutorials in Xcode, please take note of the following items mentioned in the Xcode 11 Beta Release notes:
1. After following Section 7, Step 7 in the Building Lists and Navigation tutorial, you might encounter an error in your project’s
SceneDelegate.swift
file.Workaround: Update line 14 of
SceneDelegate.swift
to use LandmarkList
instead of LandmarkDetail
:window.rootViewController = UIHostingController(rootView: LandmarkList())
2. After following Section 5, Step 3 in the Handling User Input tutorial, you might encounter an error in the preview provider.
Workaround: Undo the change to the
LandmarkDetail
initializer, so that you only add the environmentObject(_:)
modifier:struct LandmarkDetail_Preview: PreviewProvider {
static var previews: some View {
LandmarkDetail(landmark: landmarkData[0])
.environmentObject(UserData())
}
}
The web version of the SwiftUI Tutorials has the correct steps.