As in the comments linked to I edited this question here
But to answer this question and help people find the answer directly:
Swift 5 and SwiftUI
For SwiftUI create a new swift file called HostingController.swift
import SwiftUI
class HostingController<ContentView>: UIHostingController<ContentView> where ContentView : View {
override var preferredStatusBarStyle: UIStatusBarStyle {
return .lightContent
}
}
Then change the following lines of code in the SceneDelegate.swift
window.rootViewController = UIHostingController(rootView: ContentView())
to
window.rootViewController = HostingController(rootView: ContentView())
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…