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

Document supported Foundation types #3

Open
piercifani opened this issue Dec 19, 2024 · 3 comments
Open

Document supported Foundation types #3

piercifani opened this issue Dec 19, 2024 · 3 comments
Labels
question Further information is requested

Comments

@piercifani
Copy link

No description provided.

@gr-markin
Copy link
Contributor

Hi @piercifani, we have a full support of the Apple's Foundation on Android, i.e. if you use any Foundation class in your code it can be compiled for Android and works as on any Apple platform, e.g. URLSession or FileManager. But if we want to expose any Foundation type to Java/Kotlin, for example, we have a function containing a parameter of type URLSession, it will not work, so, we can not expose functions with Foundation types for now. We plan such mappings as well and work on a list of types that should be mapped first, like Date, Time etc.

@gr-markin gr-markin added the question Further information is requested label Dec 20, 2024
@piercifani
Copy link
Author

Correct, there are two sides to this question:

  • Which types like Locale, Bundle or Date are exposed to Kotlin and how?
  • Internally within our Swift code, when we call any Foundation APIs like UserDefaults, URLSession, Calendar or FileManager, what happens?

@gr-markin
Copy link
Contributor

gr-markin commented Dec 30, 2024

Hi @piercifani, currently there are no Foundation types exposed to Kotlin, we are going to expose some mostly common types like Date, Locale, URL as soon as we are done with mostly used language features (for example those that you have requested are currently in WIP). But the second part is fully supported, all Foundation types it can be used similarly to the Apple's platform. Our toolchain for Android (current version 5.10) includes the whole implementation of the https://github.com/swiftlang/swift-corelibs-foundation , including some adjustments and specific implementations for Android. The upcoming version 6.0 will contain https://github.com/swiftlang/swift-foundation.git. In other words, when you use FileManager in your swift code you will access the file system on Android exactly the same way you would access on iOS. The URLSession etc. works the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants