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

[swift2objc] Support optional primitives #1743

Open
liamappelbe opened this issue Nov 22, 2024 · 0 comments
Open

[swift2objc] Support optional primitives #1743

liamappelbe opened this issue Nov 22, 2024 · 0 comments
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) package:swift2objc
Milestone

Comments

@liamappelbe
Copy link
Contributor

Optional object types are straightforward to support, because they map to nullable object pointers in ObjC. But for optional primitive types like Int?, there's no ObjC equivalent. So the swift compiler will raise an error if you try to annotate an entity involving Int? with @objc.

The straightforward solution is to box the Int in an object.

Dart does support int?, so ideally we'd also unbox it on the Dart side. To do this we'd need to special case the box type in ffigen.

@liamappelbe liamappelbe added this to the SwiftGen MVP milestone Nov 27, 2024
@liamappelbe liamappelbe added the good first issue A good starting issue for contributors (issues with this label will appear in /contribute) label Nov 27, 2024
@liamappelbe liamappelbe moved this to Backlog in ObjC/Swift interop Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue A good starting issue for contributors (issues with this label will appear in /contribute) package:swift2objc
Projects
Status: Backlog
Development

No branches or pull requests

1 participant