Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Revise the doc for FlutterViewController initializers #52242

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,26 @@ FLUTTER_DARWIN_EXPORT
@property(nonatomic) FlutterMouseTrackingMode mouseTrackingMode;

/**
* Initializes a controller that will run the given project.
* Initializes this `FlutterViewController` for the implicit view of a new
* `FlutterEngine`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the original sentence here:

Initializes a controller that will run the given project.

I don't think we're ready yet to expose the implicit view to the user. This isn't something folks have needed to know about today. Could we punt this "implicit view" messaging until we're ready to migrate folks off the implicit view?

*
* This initializer is a shorthand for creating an engine explicitly and
* initializing with `initWithEngine:nibName:bundle:`.
*
* Since the created engine is only referred by this view controller, once thie
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Since the created engine is only referred by this view controller, once thie
* Since the created engine is only referred by this view controller, once the

* view controller is deallocated, the engine will be shut down, unless anther
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* view controller is deallocated, the engine will be shut down, unless anther
* view controller is deallocated, the engine will be shut down, unless another

* strong referrence to the engine is kept. It is recommended to use
* `initWithEngine:nibName:bundle:` if the app's implicit view might be closed
* at some point, such as running headlessly.
*
* The engine holds a weak reference to the view controller, while the view controller
* holds a strong reference to the engine.
*
* In this initializer, this controller creates an engine, and is attached to
* that engine as the default controller. In this way, this controller can not
* be set to other engines. This initializer is suitable for the first Flutter
* view controller of the app. To use the controller with an existing engine,
* use initWithEngine:nibName:bundle: instead.
* For an introduction to implicit views, see
* [PlatformDispatcher.implicitView](https://api.flutter.dev/flutter/dart-ui/PlatformDispatcher/implicitView.html).
*
* There isn't a way to create a `FlutterViewController` that's not attached
* to an engine.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need to be on this doc? I would consider removing this.

*
* @param project The project to run in this view controller. If nil, a default `FlutterDartProject`
* will be used.
Expand All @@ -103,12 +116,11 @@ FLUTTER_DARWIN_EXPORT
NS_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithCoder:(nonnull NSCoder*)nibNameOrNil NS_DESIGNATED_INITIALIZER;
/**
* Initializes this FlutterViewController with an existing `FlutterEngine`.
*
* The initialized view controller will add itself to the engine as part of this process.
* Initializes this FlutterViewController as attached to an existing
* `FlutterEngine`.
*
* This initializer is suitable for both the first Flutter view controller and
* the following ones of the app.
* The engine holds a weak reference to the view controller, while the view controller
* holds a strong reference to the engine.
*
* @param engine The `FlutterEngine` instance to attach to. Cannot be nil.
* @param nibName The NIB name to initialize this controller with.
Expand Down