How to Create hybrid (iOS and Android) app using common swift code?

I am planning to create an app using swift for iOS and android. I would like to know how to make use of Swift language to write a common code for both the platforms. Is it possible to write a code like this? if possible please guide me to do that.


You might want to check out RemObject’s Silver (I’ve read about it, but never experimented much with it.). It’s basically Swift with some extra stuff added on. Their IDEs also allows you to write Android apps in Swift and build them using Android SDK and NDK.

Each platform needs to access some platform-specific libraries, so you won’t be able to share all the code between them. How ever, you should be able to share things like data models or network controllers that are more or less platform-agnostics.

1 Like

Thanks @wowbagger . I will check the above IDEs.

I have not used it, but there is also the Readdle Swift Toolchain (GitHub, Blog post). However, it looks like it is only at Swift 5.0.3.

1 Like

If those other Android toolchains are too old, you can cross-compile the stdlib yourself using these instructions from the official docs. I submitted a pull last month that enables cross-compiling the corelibs too, you could try running the commands there with Swift trunk if you're more adventurous. I will update the docs to use that pull once it's in, hopefully it'll be in the next release in March.

There's also a cross-platform GUI you can try out, though I've never used it.

1 Like
Terms of Service

Privacy Policy

Cookie Policy