uiviewcontrollerrepresentable

Access @Environment object from UIViewControllerRepresentable object

て烟熏妆下的殇ゞ 提交于 2020-08-26 08:01:10
问题 I used this approach to incorporate camera with swiftUI: https://medium.com/@gaspard.rosay/create-a-camera-app-with-swiftui-60876fcb9118 The UIViewControllerRepresentable is implemented by PageFourView class. PageFourView is one of the TabView of the parental View. I have an @EnvironmentObject passed from the SceneDelegate to the parent view and then to PageFourView. But when I am trying to acess @EnvironmentObject from makeUIViewController method of PageFourView I get an error: Fatal error:

Background color on Navigation Bar is not set when my SwiftUI based app is launched in landscape mode

限于喜欢 提交于 2020-07-22 14:12:42
问题 I am working with a SwiftUI based app that relies on a NavigationView to transition from screens. I have a requirement to set the background color on the navigation bar and have found code that makes this work most of the time. When the app is launched in portrait mode, everything works properly across rotations. However, when the app is launched in landscape mode, the bar is the default gray and only updates after the first rotation. Below, I have the minimal amount of code to recreate my