# FlutterViewController

Objective-C

    @interface FlutterViewController
        : UIViewController <FlutterTextureRegistry, FlutterPluginRegistry, UIGestureRecognizerDelegate>
    #else
    @interface FlutterViewController : UIViewController <FlutterTextureRegistry, FlutterPluginRegistry>
    #endif

    /**
     * Initializes this FlutterViewController with the specified `FlutterEngine`.
     *
     * The initialized viewcontroller will attach itself to the engine as part of this process.
     *
     * @param engine The `FlutterEngine` instance to attach to. Cannot be nil.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithEngine:(FlutterEngine*)engine
                           nibName:(nullable NSString*)nibName
                            bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;

    /**
     * Initializes a new FlutterViewController and `FlutterEngine` with the specified
     * `FlutterDartProject`.
     *
     * This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property
     * after initialization.
     *
     * @param project The `FlutterDartProject` to initialize the `FlutterEngine` with.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithProject:(nullable FlutterDartProject*)project
                            nibName:(nullable NSString*)nibName
                             bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;

    /**
     * Initializes a new FlutterViewController and `FlutterEngine` with the specified
     * `FlutterDartProject` and `initialRoute`.
     *
     * This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property
     * after initialization.
     *
     * @param project The `FlutterDartProject` to initialize the `FlutterEngine` with.
     * @param initialRoute The initial `Navigator` route to load.
     * @param nibName The NIB name to initialize this UIViewController with.
     * @param nibBundle The NIB bundle.
     */
    - (instancetype)initWithProject:(nullable FlutterDartProject*)project
                       initialRoute:(nullable NSString*)initialRoute
                            nibName:(nullable NSString*)nibName
                             bundle:(nullable NSBundle*)nibBundle NS_DESIGNATED_INITIALIZER;

    /**
     * Initializer that is called from loading a FlutterViewController from a XIB.
     *
     * See also:
     * https://developer.apple.com/documentation/foundation/nscoding/1416145-initwithcoder?language=objc
     */
    - (instancetype)initWithCoder:(NSCoder*)aDecoder NS_DESIGNATED_INITIALIZER;

    /**
     * Registers a callback that will be invoked when the Flutter view has been rendered.
     * The callback will be fired only once.
     *
     * Replaces an existing callback. Use a `nil` callback to unregister the existing one.
     */
    - (void)setFlutterViewDidRenderCallback:(void (^)(void))callback;

    /**
     * Returns the file name for the given asset.
     * The returned file name can be used to access the asset in the application's
     * main bundle.
     *
     * @param asset The name of the asset. The name can be hierarchical.
     * @return The file name to be used for lookup in the main bundle.
     */
    - (NSString*)lookupKeyForAsset:(NSString*)asset;

    /**
     * Returns the file name for the given asset which originates from the specified
     * package.
     * The returned file name can be used to access the asset in the application's
     * main bundle.
     *
     * @param asset The name of the asset. The name can be hierarchical.
     * @param package The name of the package from which the asset originates.
     * @return The file name to be used for lookup in the main bundle.
     */
    - (NSString*)lookupKeyForAsset:(NSString*)asset fromPackage:(NSString*)package;

    /**
     * Deprecated API to set initial route.
     *
     * Attempts to set the first route that the Flutter app shows if the Flutter
     * runtime hasn't yet started. The default is "/".
     *
     * This method must be called immediately after `initWithProject` and has no
     * effect when using `initWithEngine` if the `FlutterEngine` has already been
     * run.
     *
     * Setting this after the Flutter started running has no effect. See `pushRoute`
     * and `popRoute` to change the route after Flutter started running.
     *
     * This is deprecated because it needs to be called at the time of initialization
     * and thus should just be in the `initWithProject` initializer. If using
     * `initWithEngine`, the initial route should be set on the engine's
     * initializer.
     *
     * @param route The name of the first route to show.
     */
    - (void)setInitialRoute:(NSString*)route
        FLUTTER_DEPRECATED("Use FlutterViewController initializer to specify initial route");

    /**
     * Instructs the Flutter Navigator (if any) to go back.
     */
    - (void)popRoute;

    /**
     * Instructs the Flutter Navigator (if any) to push a route on to the navigation
     * stack.
     *
     * @param route The name of the route to push to the navigation stack.
     */
    - (void)pushRoute:(NSString*)route;

    /**
     * The `FlutterPluginRegistry` used by this FlutterViewController.
     */
    - (id<FlutterPluginRegistry>)pluginRegistry;

    /**
     * A wrapper around UIAccessibilityIsVoiceOverRunning().
     *
     * As a C function, UIAccessibilityIsVoiceOverRunning() cannot be mocked in testing. Mock
     * this class method to testing features depends on UIAccessibilityIsVoiceOverRunning().
     */
    + (BOOL)isUIAccessibilityIsVoiceOverRunning;

    /**
     * True if at least one frame has rendered and the ViewController has appeared.
     *
     * This property is reset to false when the ViewController disappears. It is
     * guaranteed to only alternate between true and false for observers.
     */
    @property(nonatomic, readonly, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI;

    /**
     * Specifies the view to use as a splash screen. Flutter's rendering is asynchronous, so the first
     * frame rendered by the Flutter application might not immediately appear when the Flutter view is
     * initially placed in the view hierarchy. The splash screen view will be used as
     * a replacement until the first frame is rendered.
     *
     * The view used should be appropriate for multiple sizes; an autoresizing mask to
     * have a flexible width and height will be applied automatically.
     *
     * Set to nil to remove the splash screen view.
     */
    @property(strong, nonatomic, nullable) UIView* splashScreenView;

    /**
     * Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the
     * main bundle's `Info.plist` file.  This method will not change the value of `splashScreenView`
     * if it cannot find a default one from a storyboard or nib.
     *
     * @return `YES` if successful, `NO` otherwise.
     */
    - (BOOL)loadDefaultSplashScreenView;

    /**
     * Controls whether the created view will be opaque or not.
     *
     * Default is `YES`.  Note that setting this to `NO` may negatively impact performance
     * when using hardware acceleration, and toggling this will trigger a re-layout of the
     * view.
     */
    @property(nonatomic, getter=isViewOpaque) BOOL viewOpaque;

    /**
     * The `FlutterEngine` instance for this view controller. This could be the engine this
     * `FlutterViewController` is initialized with or a new `FlutterEngine` implicitly created if
     * no engine was supplied during initialization.
     */
    @property(weak, nonatomic, readonly) FlutterEngine* engine;

    /**
     * The `FlutterBinaryMessenger` associated with this FlutterViewController (used for communicating
     * with channels).
     *
     * This is just a convenient way to get the |FlutterEngine|'s binary messenger.
     */
    @property(nonatomic, readonly) NSObject<FlutterBinaryMessenger>* binaryMessenger;

    /**
     * If the `FlutterViewController` creates a `FlutterEngine`, this property
     * determines if that `FlutterEngine` has `allowHeadlessExecution` set.
     *
     * The intention is that this is used with the XIB.  Otherwise, a
     * `FlutterEngine` can just be sent to the init methods.
     *
     * See also: `-[FlutterEngine initWithName:project:allowHeadlessExecution:]`
     */
    @property(nonatomic, readonly) BOOL engineAllowHeadlessExecution;

    @end

Swift

    class FlutterViewController : UIViewController, FlutterTextureRegistry, FlutterPluginRegistry, UIGestureRecognizerDelegate

Undocumented

- `-initWithEngine:nibName:bundle:`

  Initializes this FlutterViewController with the specified `FlutterEngine`.

  The initialized viewcontroller will attach itself to the engine as part of this process.

  #### Declaration

  Objective-C

      - (nonnull instancetype)initWithEngine:(nonnull FlutterEngine *)engine
                                     nibName:(nullable NSString *)nibName
                                      bundle:(nullable NSBundle *)nibBundle;

  Swift

      init(engine: FlutterEngine, nibName: String?, bundle nibBundle: Bundle?)

  #### Parameters

  `engine` | The `FlutterEngine` instance to attach to. Cannot be nil.
  `nibName` | The NIB name to initialize this UIViewController with.
  `nibBundle` | The NIB bundle.

- `-initWithProject:nibName:bundle:`

  Initializes a new FlutterViewController and `FlutterEngine` with the specified `FlutterDartProject`.

  This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property after initialization.

  #### Declaration

  Objective-C

      - (nonnull instancetype)initWithProject:(nullable FlutterDartProject *)project
                                      nibName:(nullable NSString *)nibName
                                       bundle:(nullable NSBundle *)nibBundle;

  Swift

      init(project: FlutterDartProject?, nibName: String?, bundle nibBundle: Bundle?)

  #### Parameters

  `project` | The `FlutterDartProject` to initialize the `FlutterEngine` with.
  `nibName` | The NIB name to initialize this UIViewController with.
  `nibBundle` | The NIB bundle.

- `-initWithProject:initialRoute:nibName:bundle:`

  Initializes a new FlutterViewController and `FlutterEngine` with the specified `FlutterDartProject` and `initialRoute`.

  This will implicitly create a new `FlutterEngine` which is retrievable via the `engine` property after initialization.

  #### Declaration

  Objective-C

      - (nonnull instancetype)initWithProject:(nullable FlutterDartProject *)project
                                 initialRoute:(nullable NSString *)initialRoute
                                      nibName:(nullable NSString *)nibName
                                       bundle:(nullable NSBundle *)nibBundle;

  Swift

      init(project: FlutterDartProject?, initialRoute: String?, nibName: String?, bundle nibBundle: Bundle?)

  #### Parameters

  `project` | The `FlutterDartProject` to initialize the `FlutterEngine` with.
  `initialRoute` | The initial `Navigator` route to load.
  `nibName` | The NIB name to initialize this UIViewController with.
  `nibBundle` | The NIB bundle.

- `-initWithCoder:`

  Initializer that is called from loading a FlutterViewController from a XIB.

  See also: https://developer.apple.com/documentation/foundation/nscoding/1416145-initwithcoder?language=objc

  #### Declaration

  Objective-C

      - (nonnull instancetype)initWithCoder:(nonnull NSCoder *)aDecoder;

  Swift

      init(coder aDecoder: NSCoder)

- `-setFlutterViewDidRenderCallback:`

  Registers a callback that will be invoked when the Flutter view has been rendered. The callback will be fired only once.

  Replaces an existing callback. Use a `nil` callback to unregister the existing one.

  #### Declaration

  Objective-C

      - (void)setFlutterViewDidRenderCallback:(nonnull void (^)(void))callback;

  Swift

      func setFlutterViewDidRenderCallback(_ callback: @escaping () -> Void)

- `-lookupKeyForAsset:`

  Returns the file name for the given asset. The returned file name can be used to access the asset in the application’s main bundle.

  #### Declaration

  Objective-C

      - (nonnull NSString *)lookupKeyForAsset:(nonnull NSString *)asset;

  Swift

      func lookupKey(forAsset asset: String) -> String

  #### Parameters

  `asset` | The name of the asset. The name can be hierarchical.

  #### Return Value

  The file name to be used for lookup in the main bundle.

- `-lookupKeyForAsset:fromPackage:`

  Returns the file name for the given asset which originates from the specified package. The returned file name can be used to access the asset in the application’s main bundle.

  #### Declaration

  Objective-C

      - (nonnull NSString *)lookupKeyForAsset:(nonnull NSString *)asset
                                  fromPackage:(nonnull NSString *)package;

  Swift

      func lookupKey(forAsset asset: String, fromPackage package: String) -> String

  #### Parameters

  `asset` | The name of the asset. The name can be hierarchical.
  `package` | The name of the package from which the asset originates.

  #### Return Value

  The file name to be used for lookup in the main bundle.

- `-setInitialRoute:`

  Deprecated

  Use FlutterViewController initializer to specify initial route

  Deprecated API to set initial route.

  Attempts to set the first route that the Flutter app shows if the Flutter runtime hasn’t yet started. The default is “/”.

  This method must be called immediately after `initWithProject` and has no effect when using `initWithEngine` if the `FlutterEngine` has already been run.

  Setting this after the Flutter started running has no effect. See `pushRoute` and `popRoute` to change the route after Flutter started running.

  This is deprecated because it needs to be called at the time of initialization and thus should just be in the `initWithProject` initializer. If using `initWithEngine`, the initial route should be set on the engine’s initializer.

  #### Declaration

  Objective-C

      - (void)setInitialRoute:(nonnull NSString *)route;

  Swift

      func setInitialRoute(_ route: String)

  #### Parameters

  `route` | The name of the first route to show.

- `-popRoute`

  Instructs the Flutter Navigator (if any) to go back.

  #### Declaration

  Objective-C

      - (void)popRoute;

  Swift

      func popRoute()

- `-pushRoute:`

  Instructs the Flutter Navigator (if any) to push a route on to the navigation stack.

  #### Declaration

  Objective-C

      - (void)pushRoute:(nonnull NSString *)route;

  Swift

      func pushRoute(_ route: String)

  #### Parameters

  `route` | The name of the route to push to the navigation stack.

- `-pluginRegistry`

  The `FlutterPluginRegistry` used by this FlutterViewController.

  #### Declaration

  Objective-C

      - (nonnull id<FlutterPluginRegistry>)pluginRegistry;

  Swift

      func pluginRegistry() -> FlutterPluginRegistry

- `+isUIAccessibilityIsVoiceOverRunning`

  A wrapper around UIAccessibilityIsVoiceOverRunning().

  As a C function, UIAccessibilityIsVoiceOverRunning() cannot be mocked in testing. Mock this class method to testing features depends on UIAccessibilityIsVoiceOverRunning().

  #### Declaration

  Objective-C

      + (BOOL)isUIAccessibilityIsVoiceOverRunning;

  Swift

      class func isUIAccessibilityIsVoiceOverRunning() -> Bool

- `displayingFlutterUI`

  True if at least one frame has rendered and the ViewController has appeared.

  This property is reset to false when the ViewController disappears. It is guaranteed to only alternate between true and false for observers.

  #### Declaration

  Objective-C

      @property (nonatomic, readonly, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI;

  Swift

      var isDisplayingFlutterUI: Bool { get }

- `splashScreenView`

  Specifies the view to use as a splash screen. Flutter’s rendering is asynchronous, so the first frame rendered by the Flutter application might not immediately appear when the Flutter view is initially placed in the view hierarchy. The splash screen view will be used as a replacement until the first frame is rendered.

  The view used should be appropriate for multiple sizes; an autoresizing mask to have a flexible width and height will be applied automatically.

  Set to nil to remove the splash screen view.

  #### Declaration

  Objective-C

      @property (nonatomic, strong, nullable) UIView *splashScreenView;

  Swift

      var splashScreenView: UIView? { get set }

- `-loadDefaultSplashScreenView`

  Attempts to set the `splashScreenView` property from the `UILaunchStoryboardName` from the main bundle’s `Info.plist` file. This method will not change the value of `splashScreenView` if it cannot find a default one from a storyboard or nib.

  #### Declaration

  Objective-C

      - (BOOL)loadDefaultSplashScreenView;

  Swift

      func loadDefaultSplashScreenView() -> Bool

  #### Return Value

  `YES` if successful, `NO` otherwise.

- `viewOpaque`

  Controls whether the created view will be opaque or not.

  Default is `YES`. Note that setting this to `NO` may negatively impact performance when using hardware acceleration, and toggling this will trigger a re-layout of the view.

  #### Declaration

  Objective-C

      @property (nonatomic, getter=isViewOpaque) BOOL viewOpaque;

  Swift

      var isViewOpaque: Bool { get set }

- `engine`

  The `FlutterEngine` instance for this view controller. This could be the engine this `FlutterViewController` is initialized with or a new `FlutterEngine` implicitly created if no engine was supplied during initialization.

  #### Declaration

  Objective-C

      @property (nonatomic, weak, readonly) FlutterEngine *_Nullable engine;

  Swift

      weak var engine: FlutterEngine? { get }

- `binaryMessenger`

  The `FlutterBinaryMessenger` associated with this FlutterViewController (used for communicating with channels).

  This is just a convenient way to get the |FlutterEngine|‘s binary messenger.

  #### Declaration

  Objective-C

      @property (nonatomic, readonly) NSObject<FlutterBinaryMessenger> *_Nonnull binaryMessenger;

  Swift

      var binaryMessenger: FlutterBinaryMessenger { get }

- `engineAllowHeadlessExecution`

  If the `FlutterViewController` creates a `FlutterEngine`, this property determines if that `FlutterEngine` has `allowHeadlessExecution` set.

  The intention is that this is used with the XIB. Otherwise, a `FlutterEngine` can just be sent to the init methods.

  See also: `-[FlutterEngine initWithName:project:allowHeadlessExecution:]`

  #### Declaration

  Objective-C

      @property (nonatomic, readonly) BOOL engineAllowHeadlessExecution;

  Swift

      var engineAllowHeadlessExecution: Bool { get }

© 2023 Flutter. All rights reserved. (Last updated: 2023-05-23)

Generated by jazzy ♪♫ v0.14.3, a Realm project.