r/iOSProgramming • • Jul 27 '24

Discussion Can i use swift on windows?

Hey guys i want to learn swift for ios development And i dont have macbook (expensive in my place) But i have asus laptop of gb 16 gp ram core i7 9th cpu and 512 ssd can i use virtual machine let me know your what you think

0 Upvotes

13 comments sorted by

3

u/_JohnWisdom Jul 27 '24

with your spec you 100% can and your system has absolutely enough resources to run a simple/semi professional app. For learning purposes it is a great start! Hackintosh would be better resource wise, but I’m sure even on VM, you wouldn’t run into any real issues. There are a TON of videos on youtube on how to do what you are asking for. Many have even much worse computer and are still able.

I wouldn’t suggest you to publish on the app store without an original apple system though, but for learning, go for it! You have nothing to lose

2

u/Educational_Log_1035 Jul 28 '24

Uff, where do I even begin...

Point 1: Preparation If you want to install macOS through a VM, I can only recommend VMware, which recently made its Pro version free for personal use. It’s pretty much the best product you can use for this. macOS is not officially supported by VM software manufacturers because Apple doesn’t like their OS running on machines other than their own. However, with a few small workarounds and unlock tools, this is easily fixed. You can download macOS itself from the Mac Store via a friend’s Mac. You’ll get a .dmg file, which you then have to painstakingly convert into an .iso on the Mac. I hate this part.

Point 2: Installation Getting macOS to run is a real hassle. Apple makes sure you feel that the effort isn’t worth it. Everything loads forever and takes a long time.

Point 3: Performance Here are my specs:

  • i9-13900KS

  • RTX 4090

  • 64GB DDR5 6000MHz RAM

  • 4TB NVMe SSD

So, my specs are absolutely overkill. The problem is, macOS doesn’t run well on multiple threads. This means it effectively runs best in the VM with a single thread. Most tutorials will also advise you to set only 1-2 threads. Beyond 2, it becomes critical, and beyond 3, it will almost certainly crash and fail to boot. My CPU isn’t particularly strong in single-core performance, so the macOS VM wouldn’t run well anyway. Still, the VM ran so horribly, with such terrible performance, that I lost interest after the first successful boot. I opened the App Store and tested a few things, but it’s completely unsuitable for programming. I’d rather learn assembly on a Windows XP machine than ever touch a macOS VM again.

Additionally, there are other negative points, such as code signing not being available.

People have different experiences with this, and surely there are cases where a VM can work well, but I can’t report any such success. I still wish you the best of luck. Obtaining the necessary hardware is a problem for many.

1

u/Longjumping-Guide969 Jul 28 '24

Thanks for that effort bro I don't think my idea wich is vm is a good idea seems like a headache

5

u/dagmx Jul 27 '24

You can learn Swift on Windows. However making iOS apps will be very difficult because you won’t have access to the iOS SDKs, so will be limited to making command line or windows specific apps.

Alternatively you could setup your PC as a hackintosh but that can have varying results depending on your current hardware.

A VM like you suggested could also work, but you don’t have much RAM and would be dealing with a lot of slowdown.

2

u/ThePolluxStar Jul 28 '24

Swift of course, is OS Agnostic, but iOS apps you will need of a Mac.

But making iOS apps is not the only propose of Swift

3

u/AnthonyEstacado Objective-C / Swift Jul 27 '24

I tried doing something like this many years ago and while it was doable the performance was awful and there was no ability to deploy to App Store.

If you can still create a VM with the latest Mac OS and install Xcode there it will be just enough to start learning Swift but definitely not ideal

2

u/anjumkaiser Jul 28 '24

You can make a pretty decent app on an iPad using SwiftUI on Swift playgrounds. I am doing same using an iPad 9th gen. I paired it up with a keyboard and it’s good enough to work on during travel. It will have some iPad limitations but it’s good enough.

Fit the record, I’ve been a developer for 15+ years. I’d say it’s good enough of a machine to work. I started coding with machines having less than 1mb ram.

1

u/MB_Zeppin Jul 28 '24

Swift on Windows yes but for iOS development not really

1

u/LifeIsGood008 SwiftUI Jul 28 '24

You’ll be fine learning Swift but in order to build an app to an Apple device for testing or getting that tingling sense of excitement when an app works for the first time on a physical device, you will need a Mac. Also no need for a spec’d out build Mac. Get a used M1 Mac Mini if you can. If your budget allows, go for one that has 16 GB of ram and 1TB of storage

5

u/[deleted] Jul 27 '24

[removed] — view removed comment

3

u/Longjumping-Guide969 Jul 27 '24

That was helpful thx