Overriding in UIViewController for iOS extension

Thanks Joshua! I’ll watch this video later.

We implemented functionality for hiding home indicator that way:

  1. We created 2 files:

UIViewController+UIViewController_HideHomeIndicator.h

#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@interface UIViewController (UIViewController_HideHomeIndicator)
- (BOOL)prefersHomeIndicatorAutoHidden;
@end

NS_ASSUME_NONNULL_END

UIViewController+UIViewController_HideHomeIndicator.mm

#import "UIViewController+UIViewController_HideHomeIndicator.h"

@implementation UIViewController (UIViewController_HideHomeIndicator)

- (BOOL)prefersHomeIndicatorAutoHidden {
    return YES;
}

@end
  1. Add them as templates for copying to Classes folder for iOS.

  2. Add these files to your XCode project and copy back *.pbxproj file from XCode (it adds new files to list). Add new pbxproj as template to project.

  3. Profit!
    But home indicator always appears after touching device screen and dissapears after few seconds.

Maybe this approach will be usefull for someone :grinning: