iPhone X hide home indicator on view controller

If your window?.rootViewController is a UITabBarController or UINavigationController, just inherit it and add two function as follows,

override var prefersHomeIndicatorAutoHidden: Bool {
    return true
}

//@available(iOS 11, *)
override var childViewControllerForHomeIndicatorAutoHidden: UIViewController? {
    return nil
}

You should override prefersHomeIndicatorAutoHidden in your view controller to achieve that:

override var prefersHomeIndicatorAutoHidden: Bool {
    return true
}

There is another alternative. If you are looking for the behavior where the indicator dims, then when the user swipes up it activates, and when they swipe up again the home action is invoked (I.E., two swipes are needed to invoke), then the answer is here: iPhone X home indicator behavior. The short of it is to override on your UIViewController:

override var preferredScreenEdgesDeferringSystemGestures: UIRectEdge {
    return UIRectEdge.bottom
}

prefersHomeIndicatorAutoHidden only hides the indicator, but will not suppress the gesture.

And you will get what you want (If I understand your comments correctly - your question and the selected answer seem to imply the other answer).