diff --git a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h index 21b63b4a048ac..7aab78db946c8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h @@ -9,16 +9,20 @@ /// Drop-in replacement (as far as Flutter is concerned) for CAMetalLayer /// that can present with transaction from a background thread. +/// +/// Properties and method declarations must exactly match those in the +/// CAMetalLayer interface declaration. @interface FlutterMetalLayer : CALayer @property(nullable, retain) id device; -@property(nullable, readonly) id preferredDevice; +@property(nullable, readonly) + id preferredDevice API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0)) + API_UNAVAILABLE(watchos); @property MTLPixelFormat pixelFormat; @property BOOL framebufferOnly; @property CGSize drawableSize; @property BOOL presentsWithTransaction; @property(nullable) CGColorSpaceRef colorspace; -@property BOOL wantsExtendedDynamicRangeContent; - (nullable id)nextDrawable; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm index b26df26ca9a8c..b5149bfd6d8a2 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm @@ -56,11 +56,7 @@ - (void)returnTexture:(FlutterTexture*)texture; @end -@interface FlutterTexture : NSObject { - id _texture; - IOSurface* _surface; - CFTimeInterval _presentedTime; -} +@interface FlutterTexture : NSObject @property(readonly, nonatomic) id texture; @property(readonly, nonatomic) IOSurface* surface; @@ -71,11 +67,6 @@ @interface FlutterTexture : NSObject { @implementation FlutterTexture -@synthesize texture = _texture; -@synthesize surface = _surface; -@synthesize presentedTime = _presentedTime; -@synthesize waitingForCompletion; - - (instancetype)initWithTexture:(id)texture surface:(IOSurface*)surface { if (self = [super init]) { _texture = texture; @@ -186,13 +177,6 @@ - (void)onDisplayLink:(CADisplayLink*)link { @implementation FlutterMetalLayer -@synthesize preferredDevice = _preferredDevice; -@synthesize device = _device; -@synthesize pixelFormat = _pixelFormat; -@synthesize framebufferOnly = _framebufferOnly; -@synthesize colorspace = _colorspace; -@synthesize wantsExtendedDynamicRangeContent = _wantsExtendedDynamicRangeContent; - - (instancetype)init { if (self = [super init]) { _preferredDevice = MTLCreateSystemDefaultDevice(); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index b8a3f64de07a0..9358431cf5a6f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -662,6 +662,7 @@ - (UITextRange*)lineEnclosingPosition:(UITextPosition*)position @implementation FlutterTextSelectionRect +// Synthesize properties declared readonly in UITextSelectionRect. @synthesize rect = _rect; @synthesize writingDirection = _writingDirection; @synthesize containsStart = _containsStart; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index e4dbf2546fdf5..3f144aaa27875 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -79,6 +79,9 @@ @interface FlutterViewController () * ongoingTouches; // This scroll view is a workaround to accommodate iOS 13 and higher. There isn't a way to get // touches on the status bar to trigger scrolling to the top of a scroll view. We place a @@ -158,9 +161,13 @@ @implementation FlutterViewController { MouseState _mouseState; } +// Synthesize properties with an overridden getter/setter. @synthesize viewOpaque = _viewOpaque; @synthesize displayingFlutterUI = _displayingFlutterUI; -@synthesize prefersStatusBarHidden = _flutterPrefersStatusBarHidden; + +// TODO(dkwingsmt): https://github.com/flutter/flutter/issues/138168 +// No backing ivar is currently required; when multiple views are supported, we'll need to +// synthesize the ivar and store the view identifier. @dynamic viewIdentifier; #pragma mark - Manage and override all designated initializers @@ -2307,14 +2314,14 @@ - (void)onPreferredStatusBarStyleUpdated:(NSNotification*)notification { } - (void)setPrefersStatusBarHidden:(BOOL)hidden { - if (hidden != _flutterPrefersStatusBarHidden) { - _flutterPrefersStatusBarHidden = hidden; + if (hidden != self.flutterPrefersStatusBarHidden) { + self.flutterPrefersStatusBarHidden = hidden; [self setNeedsStatusBarAppearanceUpdate]; } } - (BOOL)prefersStatusBarHidden { - return _flutterPrefersStatusBarHidden; + return self.flutterPrefersStatusBarHidden; } #pragma mark - Platform views diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm index 0dede34e2e94a..acec6138d21bb 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm @@ -38,21 +38,26 @@ - (void)sendKeyEvent:(const FlutterKeyEvent&)event /// Sometimes we have to use a custom mock to avoid retain cycles in OCMock. /// Used for testing low memory notification. @interface FlutterEnginePartialMock : FlutterEngine + @property(nonatomic, strong) FlutterBasicMessageChannel* lifecycleChannel; @property(nonatomic, strong) FlutterBasicMessageChannel* keyEventChannel; @property(nonatomic, weak) FlutterViewController* viewController; @property(nonatomic, strong) FlutterTextInputPlugin* textInputPlugin; @property(nonatomic, assign) BOOL didCallNotifyLowMemory; + - (FlutterTextInputPlugin*)textInputPlugin; + - (void)sendKeyEvent:(const FlutterKeyEvent&)event callback:(nullable FlutterKeyEventCallback)callback userData:(nullable void*)userData; @end @implementation FlutterEnginePartialMock -@synthesize viewController; + +// Synthesize properties declared readonly in FlutterEngine. @synthesize lifecycleChannel; @synthesize keyEventChannel; +@synthesize viewController; @synthesize textInputPlugin; - (void)notifyLowMemory { diff --git a/shell/platform/darwin/ios/framework/Source/TextInputSemanticsObject.mm b/shell/platform/darwin/ios/framework/Source/TextInputSemanticsObject.mm index 3695947b3ccdc..f258367ae7f84 100644 --- a/shell/platform/darwin/ios/framework/Source/TextInputSemanticsObject.mm +++ b/shell/platform/darwin/ios/framework/Source/TextInputSemanticsObject.mm @@ -22,6 +22,7 @@ @interface FlutterInactiveTextInput : UIView @implementation FlutterInactiveTextInput +// Synthesize properties declared in UITextInput protocol. @synthesize beginningOfDocument = _beginningOfDocument; @synthesize endOfDocument = _endOfDocument; @synthesize inputDelegate = _inputDelegate; diff --git a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm index d3f1551533304..5505b460d4d36 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterChannelKeyResponder.mm @@ -29,6 +29,7 @@ @interface FlutterChannelKeyResponder () @implementation FlutterChannelKeyResponder +// Synthesize properties declared in FlutterKeyPrimaryResponder protocol. @synthesize layoutMap; - (nonnull instancetype)initWithChannel:(nonnull FlutterBasicMessageChannel*)channel { diff --git a/shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponder.mm b/shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponder.mm index 5feacb1d65272..f3c0106e24d02 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponder.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterEmbedderKeyResponder.mm @@ -473,6 +473,7 @@ - (void)handleResponse:(BOOL)handled forId:(uint64_t)responseId; @implementation FlutterEmbedderKeyResponder +// Synthesize properties declared in FlutterKeyPrimaryResponder protocol. @synthesize layoutMap; - (nonnull instancetype)initWithSendEvent:(FlutterSendEmbedderKeyEvent)sendEvent { diff --git a/shell/platform/darwin/macos/framework/Source/FlutterMenuPluginTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterMenuPluginTest.mm index 7d32208d93e3f..127bc5d5f29f1 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterMenuPluginTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterMenuPluginTest.mm @@ -25,6 +25,8 @@ @interface FakePluginRegistrar : NSObject @end @implementation FakePluginRegistrar + +// Synthesize properties declared in FlutterPluginRegistrar protocol. @synthesize messenger; @synthesize textures; @synthesize view; diff --git a/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizerTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizerTest.mm index a9fafe947f562..efa5fce563847 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizerTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterThreadSynchronizerTest.mm @@ -28,8 +28,6 @@ @implementation FlutterThreadSynchronizerTestScaffold { FlutterThreadSynchronizer* _synchronizer; } -@synthesize synchronizer = _synchronizer; - - (nullable instancetype)init { self = [super init]; if (self != nil) { diff --git a/shell/platform/darwin/macos/framework/Source/FlutterVSyncWaiterTest.mm b/shell/platform/darwin/macos/framework/Source/FlutterVSyncWaiterTest.mm index 02448549627ad..b7637104aab63 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterVSyncWaiterTest.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterVSyncWaiterTest.mm @@ -7,8 +7,7 @@ #import "flutter/testing/testing.h" -@interface TestDisplayLink : FlutterDisplayLink { -} +@interface TestDisplayLink : FlutterDisplayLink @property(nonatomic) CFTimeInterval nominalOutputRefreshPeriod; @@ -16,20 +15,19 @@ @interface TestDisplayLink : FlutterDisplayLink { @implementation TestDisplayLink +// Synthesize properties declared readonly in FlutterDisplayLink. @synthesize nominalOutputRefreshPeriod = _nominalOutputRefreshPeriod; -@synthesize delegate = _delegate; -@synthesize paused = _paused; - (instancetype)init { if (self = [super init]) { - _paused = YES; + self.paused = YES; } return self; } - (void)tickWithTimestamp:(CFTimeInterval)timestamp targetTimestamp:(CFTimeInterval)targetTimestamp { - [_delegate onDisplayLink:timestamp targetTimestamp:targetTimestamp]; + [self.delegate onDisplayLink:timestamp targetTimestamp:targetTimestamp]; } - (void)invalidate { diff --git a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm index 9f16f26d31f91..305b64fd3924d 100644 --- a/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/macos/framework/Source/FlutterViewController.mm @@ -341,7 +341,9 @@ @implementation FlutterViewController { FlutterThreadSynchronizer* _threadSynchronizer; } +// Synthesize properties declared readonly. @synthesize viewIdentifier = _viewIdentifier; + @dynamic accessibilityBridge; /**