迅捷;iOS 14:如何为所有SwiftUI视图设置自定义返回图像

迅捷;iOS 14:如何为所有SwiftUI视图设置自定义返回图像,swift,swiftui,ios14,xcode12,Swift,Swiftui,Ios14,Xcode12,在iOS 13应用程序中,我使用以下代码片段(将其放在ScenedLegate中)为导航视图(SwiftUI视图)设置了一个自定义的背面图像,该图像工作得非常好: UINavigationBar.appearance().backIndicatorImage = UIImage(named: "myBackImg") UINavigationBar.appearance().backIndicatorTransitionMaskImage = image

在iOS 13应用程序中,我使用以下代码片段(将其放在ScenedLegate中)为导航视图(SwiftUI视图)设置了一个自定义的背面图像,该图像工作得非常好:

UINavigationBar.appearance().backIndicatorImage = UIImage(named: "myBackImg")
        UINavigationBar.appearance().backIndicatorTransitionMaskImage = image
        UINavigationBar.appearance().tintColor = .gray
        
        /// removing back text from back button (will affect also the text in any button in the nav bar if exists)
        UIBarButtonItem
            .appearance(whenContainedInInstancesOf: [UINavigationController.self])
            .setTitleTextAttributes([.foregroundColor: UIColor.clear], for: .normal)
        UIBarButtonItem
            .appearance(whenContainedInInstancesOf: [UINavigationController.self])
            .setTitleTextAttributes([.foregroundColor: UIColor.clear], for: .highlighted)
但不幸的是,这不适用于使用Xcode 12.0.1的iOS 14设备,因为Xcode 12.0.1不显示自定义背面图像


有没有办法在iOS 14上为整个应用程序中的所有SwiftUI视图一次性设置“后退”按钮项的自定义后退图像?

它对我有效,但向右偏移?当应用程序具有复杂的视图层次结构时,它在大多数情况下不会显示