Hide HomeIndicator in SwiftUI App

UIKit apps can hide the Home indicator by using prefersHomeIndicatorAutoHidden in UIViewController.

However, in SwiftUI apps with the SwiftUI lifecycle the root ViewController returns false for that property and there is no way to change this without changing the Root ViewController. Setting my own UIHostingViewController as root would break things like .onOpenURL for SwiftUI App Lifecycle apps. so this is not an acceptable workaround.

Has anything changed in iOS 15 that makes hiding the Home indicator possible without such side effects?

Replies

I am stuck on the same thing. The fact that something so simple as hiding the home indicator is made so complex is baffling to me. Why isn't it as easy as hiding the status bar?

See also How to hide the home indicator with SwiftUI? on Stack Overflow and the accompanying gist. The complexity of this solution underscores willt42's comment.

I would greatly appreciate a view modifier like:

.homeIndicator(hidden: true)
// or
.prefersHomeIndicatorAutoHidden(true)

// similar to
.statusbar(hidden: true)
// or
navigationBarHidden(true)

statusbar(hidden:)

navigationBarHidden(_:)