prefersHomeIndicatorAutoHidden not working on iPhone X

If you show your UIViewController in UINavigationController, you have to override childViewControllerForHomeIndicatorAutoHidden() function:

extension UINavigationController {
    open override func childViewControllerForHomeIndicatorAutoHidden() -> UIViewController? {
        return topViewController
    }
}

Or if you show your UIViewController like subview of parent view controller, you also have to override this function and return child view controller.