diff --git a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h index ddbb87aa62e14..e71b078524a36 100644 --- a/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h +++ b/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h @@ -15,6 +15,8 @@ #include "FlutterPlugin.h" #include "FlutterTexture.h" +NS_ASSUME_NONNULL_BEGIN + @class FlutterEngine; /** @@ -55,8 +57,8 @@ FLUTTER_EXPORT * @param nibBundleOrNil The NIB bundle. */ - (instancetype)initWithEngine:(FlutterEngine*)engine - nibName:(NSString*)nibNameOrNil - bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; + nibName:(nullable NSString*)nibName + bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER; /** * Initializes a new FlutterViewController and `FlutterEngine` with the specified @@ -66,9 +68,9 @@ FLUTTER_EXPORT * @param nibNameOrNil The NIB name to initialize this UIViewController with. * @param nibBundleOrNil The NIB bundle. */ -- (instancetype)initWithProject:(FlutterDartProject*)projectOrNil - nibName:(NSString*)nibNameOrNil - bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithProject:(nullable FlutterDartProject*)project + nibName:(nullable NSString*)nibName + bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER; - (void)handleStatusBarTouches:(UIEvent*)event; @@ -184,4 +186,6 @@ FLUTTER_EXPORT @end +NS_ASSUME_NONNULL_END + #endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 87e605e97fd48..7e00737db8ead 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -71,10 +71,10 @@ @implementation FlutterViewController { #pragma mark - Manage and override all designated initializers - (instancetype)initWithEngine:(FlutterEngine*)engine - nibName:(NSString*)nibNameOrNil - bundle:(NSBundle*)nibBundleOrNil { + nibName:(nullable NSString*)nibName + bundle:(nullable NSBundle*)nibBundle { NSAssert(engine != nil, @"Engine is required"); - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + self = [super initWithNibName:nibName bundle:nibBundle]; if (self) { _viewOpaque = YES; _engine.reset([engine retain]); @@ -90,15 +90,15 @@ - (instancetype)initWithEngine:(FlutterEngine*)engine return self; } -- (instancetype)initWithProject:(FlutterDartProject*)projectOrNil - nibName:(NSString*)nibNameOrNil - bundle:(NSBundle*)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; +- (instancetype)initWithProject:(nullable FlutterDartProject*)project + nibName:(nullable NSString*)nibName + bundle:(nullable NSBundle*)nibBundle { + self = [super initWithNibName:nibName bundle:nibBundle]; if (self) { _viewOpaque = YES; _weakFactory = std::make_unique>(self); _engine.reset([[FlutterEngine alloc] initWithName:@"io.flutter" - project:projectOrNil + project:project allowHeadlessExecution:NO]); _flutterView.reset([[FlutterView alloc] initWithDelegate:_engine opaque:self.isViewOpaque]); [_engine.get() createShell:nil libraryURI:nil];