So, I’ve been messing around with getting Swift to run on Android. Yeah, you heard that right. Swift, that language everyone thinks is just for Apple stuff, on an Android phone. Sounds crazy, I know, but I was curious and decided to give it a shot.
First off, I started digging around to see what’s what. Turns out, there’s this thing called the Swift stdlib that you can compile for Android armv7 targets. That got me thinking, maybe this isn’t so far-fetched after all. I found that you can actually compile some basic Swift code for Android. But, let me tell you, it wasn’t a walk in the park.
I stumbled upon something called SCADE, which offers a Swift toolchain for Android Studio. Seemed like it could make things easier, so I grabbed it and started tinkering. The idea here is to integrate Swift code right into an Android Studio project. I followed their guide, which was pretty straightforward, but getting everything set up correctly was a bit of a hassle. Took some trial and error, for sure.
Then, I came across this other approach called Skip, which does transpilation. I guess that’s a fancy way of saying it converts Swift code into something Android can understand. I didn’t dive too deep into this one, but it’s on my list to check out later. Seems like a neat idea, though.
Anyway, after a bunch of setup and some head-scratching, I finally managed to run a simple “Hello, world” program on my Android device. It was a small victory, but seeing that message pop up on my Android screen, knowing it was from Swift code, was pretty darn cool.
I also ran into some info about running Swift’s test suite on Android. I haven’t tried that yet, but it sounds like a good way to make sure things are working as they should. Probably going to give that a go when I have more time.
It is so hard to solve some technical problems during the process. For example, I am trapped in some bugs, and I do not know how to deal with it. Then, I did a lot of search work, and I try to search some useful information online. Then, I tried those solutions, and did some experiments. Eventually, I solved some of them. Although there are still some problems, I finally did some achievements.
So, yeah, that’s where I’m at with this little experiment. It’s been a bit of a bumpy ride, but I’ve learned a ton along the way. Plus, it’s just fun to try and do something that not many people are doing. Who knows, maybe one day we’ll see more Swift on Android. Until then, I’ll keep on hacking away and see what else I can get to work.
Here’s what I managed to do:
- Compiled Swift code for Android using the stdlib.
- Integrated Swift into an Android Studio project with SCADE.
- Ran a basic “Hello, world” app on an Android device.
What’s Next
I’m thinking of exploring Skip’s transpilation process. And running the Swift test suite on Android is definitely on the agenda. It is interesting to see what will happen next. Let us look forward to it!
I will keep trying, and if I get any breakthrough, I will share it again.