Here is possible approach to replace default WindowGroup
window's hosting controller with any custom one (in this case w/o home indicator).
The helper extension are taken from before provided solution in https://stackoverflow.com/a/63276688/12299030.
Tested with Xcode 12 / iOS 14
@main
struct MyApp: App {
@UIApplicationDelegateAdaptor(MyAppDelegate.self) var appDelegate
var body: some Scene {
WindowGroup {
Text("") // << temporary placeholder
.withHostingWindow { window in
let contentView = ContentView().environmentObject(SomeObservableObject())
window?.rootViewController =
HideHomeIndicatorController(rootView: contentView)
}
}
}
}
and simplified variant of hosting controller to hide home indicator
class HideHomeIndicatorController<Content:View>: UIHostingController<Content> {
override var prefersHomeIndicatorAutoHidden: Bool {
true
}
}