mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
In modern Objective-C, `@property` directives automatically generate a backing ivar (property name prefixed with an underscore), the getter, and (for readwrite properties) the setter. `@synthesize` directives are generally only required if the backing ivar has a different name from the property. Also updates the FlutterMetalLayer API to match CAMetalLayer: * Adds API_AVAILABLE declaration to match that on CAMetalLayer. * Eliminates wantsExtendedDynamicRangeContent property as it's also part of CALayer's interface and unused in our implementation. Also eliminates unnecessary ivars where they're being synthesized by `@property` declarations. Previously, we were overriding the behaviour of UIViewController.prefersStatusBarHidden by synthesizing _flutterPrefersStatusBarHidden as a backing ivar. Since we're explicitly overriding the behaviour of a superclass, it's more idiomatic to synthesize a private property or explicitly declare an ivar then explicitly override the getter instead. Further, this adds documentation to cases where `@synthesize` directives are required, such as: * Creating a backing ivar for a readonly property. * Creating a backing ivar for a property with a custom getter/setter. * Synthesising the ivar, getter, and setter for a property declared in a protocol being implemented. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style