NavigationBar下的SwiftUI小白space

SwiftUI white space under the NavigationBar

我有一个带有 NavigationBar 的视图,其中包含大标题和内容。我已经更改了内容背景颜色和 NavigationBar 背景颜色。

 var body: some View {
       NavigationView {
            VStack {
               //content
            }.background(Color.green)
             .edgesIgnoringSafeArea(.bottom) //to fill the white space at the bottom
             .navigationBarTitle("Wallets")
       }
}
extension UINavigationController {
    override open func viewDidLoad() {
        super.viewDidLoad()

        let standartAppearance = UINavigationBarAppearance()       
        standartAppearance.backgroundColor = UIColor.green
        navigationBar.standardAppearance = standartAppearance
        navigationBar.scrollEdgeAppearance = standartAppearance
        navigationBar.compactAppearance = standartAppearance
    }
}

现在,如果我使用 NavigationLink 移动到下一个视图,并且该视图的标题采用 .inline 显示模式(不同的 NavigationBar 大小),在转换的那一刻我会看到白色 space在第一个导航栏下。如果我为我的 VStack 创建 .edgesIgnoringSafeArea(.all),我可以填充它,但在这种情况下,我的所有内容都跳转到 NavigationBar 下。如何将 NavigationBar 下的 space 着色为自定义颜色?

看起来这是一个错误。我没有找到正常的解决方案。这是一个解决方法:

我们应该计算 NavigationBar 的高度并填充它后面的 space。

var deviceHeight: CGFloat {
    UIScreen.main.bounds.height
}

  func calcPadding() -> CGFloat {
        var padding: CGFloat = 0.0
        switch self.deviceHeight {
        case 568.0: padding = 94.0 + 6.0
        case 667.0: padding = 96.0 + 10.0
        case 736.0: padding = 96.0 + 10.0
        case 812.0: padding = 106.0 + 10.0
        case 896.0: padding = 106.0 + 10.0
        default:
            padding = 106.0
        }

    return padding
}


var body: some View {
    NavigationView {
        VStack {
            VStack {
                 //content
            }
            .padding(.top, calcPadding())
            .background(Color.myBackground)
        }
        .background(Color.myBackground)
        .edgesIgnoringSafeArea(.all)
    }
}