简体   繁体   中英

Landmarks SwiftUI Tutorial - Creating watchOS App - Navigation Broken

I'm just doing SwiftUI tutorial and I'm stuck at https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app (section 4, Add the Landmarks List). Everything worked fine till now, navigation links on the watchOS are not working, just nothing happens. I found on StackOverflow someone with same problem in comments, but there wasn't any reply. ( NavigationLink broken on watchOS? ) Someone said It's broken since watchOS 8.1. What to do to start the links working? :D

Code:

ForEach(filteredLandmarks) { landmark in
                    NavigationLink {
                        LandmarkDetail(landmark: landmark)
                    } label: {
                        LandmarkRow(landmark: landmark)
                    }
                }.navigationTitle("Landmarks")

Project files: https://docs-assets.developer.apple.com/published/d46bb54c0c90d4e01351338f4627245e/15600/CreatingAwatchOSApp.zip

I just ran into the same issue in the live preview. Digging around I couldn't find a solution, but when I ran the app in the simulator, the links did work. This was with Xcode 13.4.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM