I've notice that .navigationTitle(_:) always causes layout constraints warnings. Given this example, which is in Apple documentation you can check that the layout constraint warning appears only when .navigationTitle(_:) is added. Here is the sample code:
Notice that the same warning appears when I use .navigationBarTitle(_:) which is deprecated-6p1k7) by the way. This stack overflow post is the most recent about this issue but there is no much information. I just wondering if is something wrong with the code or it's just a bug. Is there any workaround to avoid this warning?
Code Block swift struct DestinationPageView: View { var color: Color var body: some View { Text("Destination Page") .font(.title) .foregroundColor(color) } } struct ContentView: View { var body: some View { NavigationView { List { NavigationLink( destination: DestinationPageView(color: .purple) ) { Text("Purple Page") } NavigationLink( destination: DestinationPageView(color: .pink) ) { Text("Pink Page") } NavigationLink( destination: DestinationPageView(color: .orange) ) { Text("Orange Page") } } .navigationTitle("Title") } } }
Notice that the same warning appears when I use .navigationBarTitle(_:) which is deprecated-6p1k7) by the way. This stack overflow post is the most recent about this issue but there is no much information. I just wondering if is something wrong with the code or it's just a bug. Is there any workaround to avoid this warning?