Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

iOS: Clean up @synthesize directives / ivars #56665

Merged
merged 1 commit into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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<MTLDevice> device;
@property(nullable, readonly) id<MTLDevice> preferredDevice;
@property(nullable, readonly)
id<MTLDevice> 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<CAMetalDrawable>)nextDrawable;

Expand Down
18 changes: 1 addition & 17 deletions shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ - (void)returnTexture:(FlutterTexture*)texture;

@end

@interface FlutterTexture : NSObject {
id<MTLTexture> _texture;
IOSurface* _surface;
CFTimeInterval _presentedTime;
}
@interface FlutterTexture : NSObject

@property(readonly, nonatomic) id<MTLTexture> texture;
@property(readonly, nonatomic) IOSurface* surface;
Expand All @@ -71,11 +67,6 @@ @interface FlutterTexture : NSObject {

@implementation FlutterTexture

@synthesize texture = _texture;
@synthesize surface = _surface;
@synthesize presentedTime = _presentedTime;
@synthesize waitingForCompletion;

- (instancetype)initWithTexture:(id<MTLTexture>)texture surface:(IOSurface*)surface {
if (self = [super init]) {
_texture = texture;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ @interface FlutterViewController () <FlutterBinaryMessenger, UIScrollViewDelegat
@property(nonatomic, assign) BOOL isHomeIndicatorHidden;
@property(nonatomic, assign) BOOL isPresentingViewControllerAnimating;

// Internal state backing override of UIView.prefersStatusBarHidden.
@property(nonatomic, assign) BOOL flutterPrefersStatusBarHidden;

@property(nonatomic, strong) NSMutableSet<NSNumber*>* 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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ @interface FlutterInactiveTextInput : UIView <UITextInput>

@implementation FlutterInactiveTextInput

// Synthesize properties declared in UITextInput protocol.
@synthesize beginningOfDocument = _beginningOfDocument;
@synthesize endOfDocument = _endOfDocument;
@synthesize inputDelegate = _inputDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ @interface FlutterChannelKeyResponder ()

@implementation FlutterChannelKeyResponder

// Synthesize properties declared in FlutterKeyPrimaryResponder protocol.
@synthesize layoutMap;

- (nonnull instancetype)initWithChannel:(nonnull FlutterBasicMessageChannel*)channel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ @interface FakePluginRegistrar : NSObject <FlutterPluginRegistrar>
@end

@implementation FakePluginRegistrar

// Synthesize properties declared in FlutterPluginRegistrar protocol.
@synthesize messenger;
@synthesize textures;
@synthesize view;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ @implementation FlutterThreadSynchronizerTestScaffold {
FlutterThreadSynchronizer* _synchronizer;
}

@synthesize synchronizer = _synchronizer;

- (nullable instancetype)init {
self = [super init];
if (self != nil) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,27 @@

#import "flutter/testing/testing.h"

@interface TestDisplayLink : FlutterDisplayLink {
}
@interface TestDisplayLink : FlutterDisplayLink

@property(nonatomic) CFTimeInterval nominalOutputRefreshPeriod;

@end

@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,9 @@ @implementation FlutterViewController {
FlutterThreadSynchronizer* _threadSynchronizer;
}

// Synthesize properties declared readonly.
@synthesize viewIdentifier = _viewIdentifier;

@dynamic accessibilityBridge;

/**
Expand Down