I wrote some codes by advices of Deepseek
You'd probably better try first to understand the code you are writing.
navigationDestination should come after the List:
NavigationSplitView {
List{
NavigationLink("Account",value: 1)
NavigationLink("Chat",value: 2)
NavigationLink("Project",value: 3)
NavigationLink("Enviroments",value: 4)
}
.navigationDestination(for: Int.self) { number in
switch number {
case 1: AccountView()
case 2: ChatView()
case 3: ProjectView()
case 4: EnvView()
default: Text("未知页面")
}
}
On what device are you testing ? NavigationSplitView shrinks down to a single column when there is not enough room, such as iPhone.
Topic:
Programming Languages
SubTopic:
Swift