-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] Add platform view documentation #10796
Conversation
// ignore_for_file: unused_local_variable | ||
|
||
// #docregion import | ||
import 'package:flutter/foundation.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part of a project? We use flutter projects to confirm the code is up to date as flutter changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find any related projects for this, but can confirm the code passes analysis and compiles, similar to the iOS code in native_view_example_3.dart
. I couldn't find any project on GitHub that included this code though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should wrap it in a project here. @khanhnwin can give progress on how to do this in a way that makes sure this code will stay correct going forward.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@khanhnwin currently the Dart code is checked into the examples directory similar to the iOS/Android versions, but the Swift code is not (also similar to the iOS/Android versions). Where's the best place to land that code?
@domesticmouse do you think we should hold off landing this until that happens, or follow up with separate PRs that lands macOS, iOS, and Android versions of the native code as well?
Agreed we should do this though -- writing the Swift code for this involved basically recreating the exact project you're asking for, just to be sure the code is actually correct.
Visit the preview URL for this PR (updated for commit bd8c6aa): https://flutter-docs-prod--pr10796-macos-platformview-docs-hj2iqzhf.web.app |
Does this fix #9424? |
@atsansone yes, this will fix that bug; added to the description -- thanks! |
Technically we've never supported Obj-C as a language for macOS. In practice it works because of interop of course, but we haven't traditionally done documentation or examples in anything but Swift. |
9cc0d4f
to
bbcf54e
Compare
This adds documentation on authoring and using platform views for Flutter apps targeting macOS. The initial version of this documentation is Swift-only, but a follow-up will add Objective-C example code. Fixes: flutter#9424
66db5de
to
a57cf9f
Compare
Thanks. Was thinking it might be handy just in case people had some existing Obj-C NSViews they'd like to wrap but you're entirely right: we don't even have an Obj-C template for macOS, and people in that boat can just expose their own Swift-friendly header to the plugin. Not only that, but publishing Obj-C source implies that we're willing to commit to supporting that use-case and we aren't in a position to do so. Removed the tabs and sending this out as Swift-only. |
Alright; this is ready for a proper review. |
8b86196
to
d0f5297
Compare
d0f5297
to
d5ca3ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. Thanks so much for this, @cbracken!
Does this need any version note or similar clarification? |
@cbracken, are these docs valid for the current stable release? If not, I can add a note at the top stating that fact. |
@loic-sharma, do you know if this info is valid as of now, or if it's valid after the next release? Before I land it, I want to be clear. If it's for the next release, I can still land it, but will first add a note. |
@sfshaza2 In general we don't want to tell people to use macOS platform views until after the next stable release (due to critical missing functionality like gesture support). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a version note. Thanks for that info, @stuartmorgan!
This adds documentation on authoring and using platform views for Flutter apps targeting macOS.
The initial version of this documentation is Swift-only, but a follow-up will add Objective-C example code.
Fixes: #9424
Presubmit checklist