Flutter iOS Embedder
FlutterPlatformViews.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
7 
8 #import <UIKit/UIKit.h>
9 
10 #import "FlutterCodecs.h"
11 #import "FlutterMacros.h"
12 
14 
15 /**
16  * Wraps a `UIView` for embedding in the Flutter hierarchy
17  */
18 @protocol FlutterPlatformView <NSObject>
19 /**
20  * Returns a reference to the `UIView` that is wrapped by this `FlutterPlatformView`.
21  */
22 - (UIView*)view;
23 @end
24 
26 @protocol FlutterPlatformViewFactory <NSObject>
27 /**
28  * Create a `FlutterPlatformView`.
29  *
30  * Implemented by iOS code that expose a `UIView` for embedding in a Flutter app.
31  *
32  * The implementation of this method should create a new `UIView` and return it.
33  *
34  * @param frame The rectangle for the newly created `UIView` measured in points.
35  * @param viewId A unique identifier for this `UIView`.
36  * @param args Parameters for creating the `UIView` sent from the Dart side of the Flutter app.
37  * If `createArgsCodec` is not implemented, or if no creation arguments were sent from the Dart
38  * code, this will be null. Otherwise this will be the value sent from the Dart code as decoded by
39  * `createArgsCodec`.
40  */
41 - (NSObject<FlutterPlatformView>*)createWithFrame:(CGRect)frame
42  viewIdentifier:(int64_t)viewId
43  arguments:(id _Nullable)args;
44 
45 /**
46  * Returns the `FlutterMessageCodec` for decoding the args parameter of `createWithFrame`.
47  *
48  * Only needs to be implemented if `createWithFrame` needs an arguments parameter.
49  */
50 @optional
52 @end
53 
55 
56 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_HEADERS_FLUTTERPLATFORMVIEWS_H_
NS_ASSUME_NONNULL_END
#define NS_ASSUME_NONNULL_END
Definition: FlutterMacros.h:20
-[FlutterPlatformViewFactory-p createArgsCodec]
NSObject< FlutterMessageCodec > * createArgsCodec()
NS_ASSUME_NONNULL_BEGIN
#define NS_ASSUME_NONNULL_BEGIN
Definition: FlutterMacros.h:19
FlutterMacros.h
-[FlutterPlatformView-p view]
UIView * view()
FlutterCodecs.h
FlutterPlatformViewFactory-p
Definition: FlutterPlatformViews.h:26
FlutterMessageCodec-p
Definition: FlutterCodecs.h:18
FLUTTER_DARWIN_EXPORT
#define FLUTTER_DARWIN_EXPORT
Definition: FlutterMacros.h:14
FlutterPlatformView-p
Definition: FlutterPlatformViews.h:18