-
Notifications
You must be signed in to change notification settings - Fork 69
[swift2objc] Support Swift ARC features #2055
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
base: main
Are you sure you want to change the base?
[swift2objc] Support Swift ARC features #2055
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to figure out why the workflows aren't running. I'm pretty sure you can't apply any of these annotations to a property with a custom getter. So I think the generated code in classes_and_properties_output.swift won't compile (and the test should fail).
The weak
and unowned
annotations determine how reference counting works for a stored property. Our wrapper doesn't actually hold any direct references to the underlying property, so these annotations probably aren't relevant to us.
Similarly for the lazy
annotation, the laziness is all handled by the underlying property, so I'm not sure it's actually relevant at the wrapper level.
I like the refactor in parse_variable_declaration.dart
, with the ParsedPropertyInfo
, so
if the rest of this PR isn't needed, maybe it still makes sense to land that by itself?
I was thinking we would want to model Swift relationships and functionality as closely as possible, as end users might expect a class to work in a certain way, which is why I aimed at preserved such functionality in the wrappers |
I don't think you're allowed to put these annotations on computed properties. I think they're only for stored properties. Their functionality wouldn't really make sense for computed properties. |
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. API leaks ✔️The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
|
I tried using them, and it compiled to give me Objective-C header code successfully.
Much of that refactor should be merged into main already thanks to #2056. |
Fixes #2053
This pull request adds support for Swift ARC features including
lazy
,weak
andunowned
variables.@objc
suffices)lazy
variablesweak
variablesunowned
variables