engine
engine copied to clipboard
Expose macOS -[FlutterViewController initWithEngine:::] in header
To support macOS add-to-app, move initWithEngine:
into header so the host app can run the warm up the engine and pass it into a view controller later to display the Flutter views.
This will match the iOS pattern documented in https://docs.flutter.dev/development/add-to-app/ios/add-flutter-screen?tab=engine-swift-tab#show-a-flutterviewcontroller-with-your-flutterengine
Fixes https://github.com/flutter/flutter/issues/105347
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
- [x] I listed at least one issue that this PR fixes in the description above.
- [x] I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
- [x] I updated/added relevant documentation (doc comments with
///
). - [x] I signed the CLA.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
I haven't had a chance to look yet (I'm OOO today) but I'm pretty sure anyone trying to do what the PR describes enabling will hit https://github.com/flutter/flutter/issues/74735
So we should probably fix that first.
I noticed that initWithEngine
calls setViewController
on the engine, but setViewController
will get called again by launchEngine
This causes the view not to show, because the viewController has not allocated its flutterView
yet, so that's what is passed to the renderer and is never reassigned. I think the proper fix would be to remove the setViewController
call from initWithEngine
?
Sorry; I never linked back here when I commented on the other issue. See notes here: https://github.com/flutter/flutter/issues/74735#issuecomment-1157931202
This looks blocked. Is that right @jmagman & @cbracken ?
We'll want to fix https://github.com/flutter/flutter/issues/74735 first, yes. Added some notes on that bug the other day. Marked as WIP to get it off your PR triage list till then.
@jmagman What's the status of this PR?
Closing in favor of https://github.com/flutter/engine/pull/36410