The error on line 3 is a bug in Swift where it can't determine the type of an expression in reasonable time. It's quite an annoying one, but there are ways to mitigate it (search for the error on your favorite search engine).
Other than that, your code is syntactically, but may not play well on screen when having two navigation views positioned horizontally. Take this code for example:
struct ContentView: View {
var body: some View {
NavigationView {
List(1..<11, id: \.self) { num in
NavigationLink("Number: \(num)", destination: Text("Destination Number: \(num)"))
NavigationLink("Integer: \(num)", destination: Text("Destination Integer: \(num)"))
}
}
}
}
This creates a list where the two navigation views are positioned horizontally (by default, list rows are horizontal instead of vertical). However, the two arrows indicating a new view is ahead are visible, and clicking on either one will present the second one right after clicking the back button.
Wrapping the row content in a ScrollView solves both of those issues, but it's not ideal, because on a platform like macOS, it treats it like its own individual scroll view, which makes scrolling down weird. But on iOS, it looks and functions correctly. The same for iPadOS when there's no third split view.