auto hide home indicator

This commit is contained in:
iAugus 2021-06-11 10:17:17 +08:00
parent c263405292
commit 9a3c2d3385
No known key found for this signature in database
GPG key ID: 86EFA3E97D61C350

View file

@ -26,7 +26,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)
let context = persistentContainer.viewContext
window.rootViewController = UIHostingController(rootView: contentView.environmentObject(MusicObserver()).environment(\.managedObjectContext, context))
window.rootViewController = HostingController(rootView: contentView.environmentObject(MusicObserver()).environment(\.managedObjectContext, context))
self.window = window
window.makeKeyAndVisible()
}
@ -85,3 +85,8 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}
class HostingController<Content>: UIHostingController<Content> where Content: View {
override var prefersHomeIndicatorAutoHidden: Bool {
return true
}
}