Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[macOS] Rename FlutterViewController.id to viewId #40323

Merged
merged 1 commit into from Mar 15, 2023

Conversation

cbracken
Copy link
Member

@cbracken cbracken commented Mar 15, 2023

id is a type in Objective-C similar to dynamic in Dart, and while it can be used as an identifier, it's bad practice to do so and results in unidiomatic code. viewId also more clearly indicates the purpose of this identifier.

Also replaces the use of @dynamic (which is meant to indicate properties whose implementation is either added at runtime or stashed away in a superclass) with @synthesize, which is an idiomatic way to declare that an ivar _foo should be synthesized for property foo.

While this is renaming a public property and thus constitutes a breaking change, multi-view support is still under development and thus, practically speaking, this should not be a breaking change.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

`id` is a type in Objective-C similar to dynamic in Dart, and while it
*can* be used as an identifier, it's bad practice to do so and results
in unidiomatic code. `viewId` is also more clearly indicates the purpose
of this identifier.

Also replaces the use of @dynamic (which is meant to indicate properties
whose implementation is either added at runtime or stashed away in a
superclass) with @synthesize, which is an idiomatic way to declare that
an ivar `_foo` should be synthesized for property `foo`.

While this is renaming a public property and thus constitutes a breaking
change, multi-view support is still under development and thus,
practically speaking, this should not be a breaking change.
Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cbracken
Copy link
Member Author

Note - I will send a followup that deals with the other @dynamic properties momentarily but wanted to keep this one separate since it makes an API change.

It looks like the id property was added post-review in #38981. Please make sure you get a re-review if adding new API.

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 15, 2023
@auto-submit auto-submit bot merged commit 903ea2e into flutter:main Mar 15, 2023
36 checks passed
@cbracken cbracken deleted the id-to-viewId branch March 15, 2023 23:43
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 15, 2023
@dkwingsmt
Copy link
Contributor

dkwingsmt commented Mar 15, 2023

Do we need the @synthesize at all, since ObjC should be synthesizing them automatically?

Edit: Does ObjC auto-synthesize readonly properties?

@cbracken
Copy link
Member Author

cbracken commented Mar 16, 2023

Edit: Does ObjC auto-synthesize readonly properties?

You got it -- nope, it doesn't. We've provided an implementation of the accessor for viewId, so it's not synthesized by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-macos
Projects
None yet
3 participants