From 10f088e64ddf8410e115c00ac8bf63551b02e014 Mon Sep 17 00:00:00 2001 From: Alex Wallen Date: Thu, 15 Sep 2022 13:56:18 -0700 Subject: [PATCH] Add documentation for `platform_view` example. (#111623) --- .../macos/Runner/MainFlutterWindow.swift | 6 ++++++ .../macos/Runner/PlatformViewController.swift | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/examples/platform_view/macos/Runner/MainFlutterWindow.swift b/examples/platform_view/macos/Runner/MainFlutterWindow.swift index 9686c15bc8..39d5e0e891 100644 --- a/examples/platform_view/macos/Runner/MainFlutterWindow.swift +++ b/examples/platform_view/macos/Runner/MainFlutterWindow.swift @@ -5,6 +5,12 @@ import Cocoa import FlutterMacOS +/** + The main application window. + + Performs Flutter app initialization, and handles channel method calls over the + `samples.flutter.io/platform_view` channel. +*/ class MainFlutterWindow: NSWindow { override func awakeFromNib() { let flutterViewController = FlutterViewController.init() diff --git a/examples/platform_view/macos/Runner/PlatformViewController.swift b/examples/platform_view/macos/Runner/PlatformViewController.swift index 34b242bdc5..12bbd4cbe8 100644 --- a/examples/platform_view/macos/Runner/PlatformViewController.swift +++ b/examples/platform_view/macos/Runner/PlatformViewController.swift @@ -4,6 +4,17 @@ import Cocoa +/** +`ViewControllers` in the xib can inherit from this class to communicate with +the flutter view for this application. ViewControllers that inherit from this +class should be displayed as a popover or modal, with a button that binds to +the IBAction `pop()`. + +To get the value of the popover during close, pass a callback function as +the `dispose` parameter. The callback passed will have access to the +`PlatformViewController` and all of it's properties at close so that the `count` +can be passed back through the message channel if needed. +*/ class PlatformViewController: NSViewController { var count: Int = 0