环境是XCode13.1 随便简单的NavigationView中只要使用修饰符.navigationBarTitle("mytitle") 在运行时控制台就会产生警告

比如下面这么单纯可爱的代码 模拟器调试运行时居然也能产生这样的警告
// ===============================================
// 这是样例代码
import SwiftUI

struct HomeView: View {
    var body: some View {
        NavigationView {
            Text("Text")
                .navigationBarTitle("My Title")
        }
    }
}

// ===============================================
// 这是运行时警告的一部分特征提示
Unable to simultaneously satisfy constraints.

Probably at least one of the constraints in the following list is one you don't want.

Try this:

(1) look at each constraint and try to figure out which you don't expect;

(2) find the code that added the unwanted constraint or constraints and fix it.


// =============================================================
// 下面经过查找stackoverflow.com给出的解决方案

方案一:采用navigationViewStyle修复

       struct ContentView: View {
        var body: some View {
            NavigationView {
                VStack {
                    Text("Hello, world!")
                        .padding()
                    Spacer()
                }
                .navigationBarTitle("Hey there", displayMode: .inline)
            }
            .navigationViewStyle(StackNavigationViewStyle())// 修复使用这一行
        }
    }


方案二:采用新方式

.navigationBarTitleDisplayMode(.inline)
.toolbar(content: {
     ToolbarItem(placement: .principal, content: {
     Text("Title")
  })})    


// ==============================================================
// 最后给出解决方案原链接
stackoverflow上的原链接