Skip to content

Conversation

@madsodgaard
Copy link
Contributor

Adds support to JNI mode for extracting Foundation.Date as java.time.Instant.

Copy link
Collaborator

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

Neat :-) Please add info about it to the feature list docs

| Existential parameters `f(x: any (A & B)) ` |||
| Existential return types `f() -> any Collection ` |||
| Foundation Data and DataProtocol: `f(x: any DataProtocol) -> Data` |||
| Foundation Date: `f(date: Date) -> Date` |||
Copy link
Collaborator

Choose a reason for hiding this comment

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

because it's an unusual conversion I think we have to add actual docs about it

@ktoso
Copy link
Collaborator

ktoso commented Jan 9, 2026

I keep thinking about this from an overall project perspective, it is a bit random to bless a few types, but yes this one would work kinda well...

@madsodgaard
Copy link
Contributor Author

madsodgaard commented Jan 9, 2026

@ktoso Hm, imo this project exists to provide a seamless Swift/Java interop story. Since we are generating Java code meant to be used on Java platforms, perhaps also by Java developers, I think it makes sense to bridge any matching types, such as UUID, Date,URL etc...

The alternative is that the developer has to use a generated type Swift.Date like we do for Data in FFM. That will probably often (for these kind of "utility" types") result in the developer having to convert their Java types to the Swift wrapped types. I understand why it makes sense for Data because of memory copying etc, but not sure that its the same motivation for the above types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants