Interested in learning from the Dark Side

Hello, I'm sure this may have come up before. But I am currently a Windows user. I am interested in learning to program, as a hobby, if anything other comes from it bonus. I'm already

But at the time a mac isn't in my budget, and so far what I can gather from here is possibly using WSL for swift is the better option than Windows natively, someone please correct me if I'm wrong.

Also if someone could point me to any learning resources that are not mac centric. There are a gazillion Udemy courses, but many seem outdated. Any guidance would be great.

Thanks so much for your time, cheers!

1 Like

Hi @TimApple ,

I'm currently working on a cross-platform Swift course for higher education (but not assuming any prior programmming experience). The course itself is finished, but not yet published.

If you're interested in test driving it on Windows, feel free to DM me, and I'll hook you up with a free preview copy.

You can use the official Windows build by @compnerd and Visual Studio Code. No need for WSL.


Thank you, very kind of you to offer. I cannot DM you here, do you mean on twitter?

I'd suggest you to start with the Swift book: The Basics — The Swift Programming Language (Swift 5.7). If you have ever learned any other programming language before, it should be rather easy to follow.

For using Swift in Linux, this document will be helpful: GitHub - swift-server/guides: Guides for building, debugging and deploying Swift Server applications (That's what I read about. I haven't got a chance to use Swift in Linux myself).

When you feel comfortable about the Swift language and would like to program apps on iOS in future, you will find the Stanford CS193p course very helpful:

Happy hacking.

1 Like

Thanks for the info...iOS dev will come when I can afford to replace my machine with a

If you have an Android phone or tablet that isn't really old (Android 7 or newer), you can install the Termux app and type pkg install swift to try Swift out on there. Combined with a bluetooth or USB keyboard, you can type out snippets from the Swift book @rayx linked.

My Android phone is my development "workstation:" this is pretty much what my desk looks like, except I use the phone as a touchpad and have a full USB keyboard instead. I regularly build large projects like the Swift toolchain on my Snapdragon 888 phone, takes a couple hours and works fine.


That is a really cool setup, what is performance like? Are you doing web dev on it? Or are you going cray, cray, and compiling binaries on it?

what is performance like?

Good, it benchmarks about as fast as a 2017 Core i7 Macbook Pro, I figure I build Swift packages at about the same speed. It's no M1, but it's good enough and much more portable: I just slip it in my pocket.

Are you doing web dev on it?

No, my phone is way overpowered for that, :wink: and I don't do any web dev.

Or are you going cray, cray, and compiling binaries on it?

Building the full Swift toolchain means building most of LLVM, which takes hours. The only drawback is that it rarely overheats when building such giant projects and is connected to an external monitor, as it has no fan.

So what are you building? Sorry for all the questions by the way, the setup fascinates me though. Do you just do backend with swift? Or are you using one of the cloud vms to build apps for mac/ios?

No problem. Right now, I've been porting the toolchain and various Swift libraries to Android. I want to write an Android app in Swift, like these guys have already done. I'm one of the few Swift devs who has never used it on mac/iOS, ie I've never used the official Apple toolchain.

1 Like

What drew you to swift, being a non-apple person. It's an unusual choice unless you just want the challenge?

other choices would be some online playground like this or playground app on iPad (from which you can even deploy to appstore since recently).

I was looking for a language that read easily- I'm big on syntax and avoiding line noise in my code, hence no Rust- had good native compilation, and boasted a decent-sized community behind it. I narrowed it down to Kotlin and Swift, and chose Swift because its native compilation was much more advanced than Kotlin/Native in early 2019.

Since these languages are all open source these days, I didn't expect much of a challenge and indeed was happy to find Swift had already been ported to Android by open-source contributors and I proceeded to fill in some remaining gaps.

@Finagolfin, is it possible to write "normal" UI android apps in swift only, or would that have to be a hybrid with Java/Kotlin host app, swift components and JNI in between?

I think if you want to use Android's built-in GUI, yes, some hybrid like that is the only option. However, since Android exposes OpenGL/Vulkan, you can use other GUI toolkits that target those renderers and support touch, which is what flowkey apears to be doing with their Android app written in Swift.

i see, like flutter, not fond if this approach. i wonder what's the ultimate underlying limitation... is it possible to create swift -> kotlin/java interop similar to how swift -> Obj-C is done? or is it even theoretically impossible because of garbage collection vs ARC differences?

Well, the most immediate limitation is the Android GUI is not exposed to C or C++, despite likely being written in those languages for performance. google wants you to use Java or Kotlin, not even C or C++, so it doesn't provide public C/C++ GUI toolkit APIs (I suppose you could call the private APIs anyway, but that may not be stable). I'm not familiar with the tighter GC/ARC integration issues that might come up, and I've said it's not worth pushing for that for me.

1 Like

C or C++ is not essential, Apple UI frameworks also don't expose C or C++ accessible API. swift interop with Obj-C which allows it to work with UIKit, etc. it's not immediately obvious why a similar interop can't be done between swift and Java (with enough effort), so one can write:

public class MainActivity: Activity {
    public override func onCreate(_ bundle: Bundle) {

        let label = TextView(self)
        label.setText("Hello world!")


things to solve would be:

  • ARC vs garbage collection (xamarin solved this somehow).
  • swift C interop. non GC language like C would cause problems in this hypothetical "swift/Java" environment. to not deal with JNI - C interop can be thrown away in such environment.
  • JVM vs LLVM differences.
  • given relatively small syntax differences between Swift and Kotlin another option could be Swift to Kotlin preprocessor.

Yep, broadly three options:

  1. Use existing methods like JNI or some serialization option like protobuffers: people are doing this today, such as in that large Android thread I linked you.

  2. Compile Swift natively as it is today but come up with some new interface to call Java methods from Swift. Not sure this would be possible to do purely on the Swift side though, may require Java changes too, which google may not provide.

  3. Translate Swift to run on the JVM, whether through Max's idea of compiling Swift to JVM bytecode in that Android thread, or your "Swift to Kotlin preprocessor" idea.

The latter two integrate the languages more tightly, so you get greater performance, at the cost of more work getting the two language runtimes seamlessly working together.

I'm fine with the first option, ie the status quo, as I don't have some giant Java codebase I need to tightly integrate with.

1 Like