It includes the Swift compiler, Interface Builder and other tools needed to upload your app to the App Store. In short, Xcode consists of everything you need to build iOS apps, but it only runs on Mac!
And that’s what the main problem is. Your wish to develop iOS apps on PC can be only be fulfilled only if you buy any PC with OS X, now called MacOS, on it.
Apple does not license its operating system to other computers or laptops which means if you buy MacOS, you agree to the term that you will run it only on Apple hardware.
This prohibits you to develop iOS apps on any other operating system.
A solution to this is running Xcode on Windows! Yes, you read it right. So let’s figure out how you can make this happen.
1. Use VirtualBox and install MacOS on your windows PC
Using a virtual machine is considered to the one of the easiest ways for developing iOS apps on a windows PC. That machine will create an environment in which the OS will run and it will seem as if it’s running on the hardware.
This process is called virtualization, and it allows you to run windows on linux, MacOS on windows or even windows on MacOS.
To run MacOS on a virtual machine, you will require 2 things:-
- A copy of the MacOS, as an installer or virtual image file.
- A virtual machine tool like VMware (paid) or VirtualBox (free of cost).
You can either borrow the MacOS from someone or download it from the App Store. There are various installers on the internet as well which would help you.
Then you need to install VirtualBOx, and “mount” the MacOS installer in a new virtual machine.
Note- recommended pc specs are:- 4-8GB ram, an intel i5 or i7 compatible CPU and atleast 10-15GB of free space on your disk.
However, it should be noted that using MacOS on non-apple hardware is against Apple’s rules.
2. Rent a Mac in the cloud
Another easy way to get the MacOS, albeit costlier, is to rent it in the cloud
It is quite simple:
- Someone with a lot of Macs will connect them to the internet
- You then sign in one of those Macs with a Remote Desktop Connection (RDP)
- And you’re set to go. Use this Mac in your windows PC from anywhere!
Services like MacinCloud and MacStadium offer affordable packages to rent Mac usually paid on a monthly basis with prices generally starting at $20/month. It allows you to choose from several hardware options like Mac pro or Mac mini.
You need to connect to those cloud-based Macs via a Remote Desktop Connection (RDP). It can be found in both the windows and linux operating systems. Once you have logged in, you can install Xcode and start developing some apps.
3. Code with a Swift Sandbox
The question that pops up is that do you really need to go through such hassle to get Xcode? Ultimately, the answer to this is yes. Before you are done with your app, you have already learned coding which you can do right here, right now and that too without having to use Xcode.
Swift is an open-source language which mean that you can effectively run it on any hardware without issues. It can also be used on your browser provided that someone has ported the language to various browsers.
Although, a great implementation already exists: the Swift Sandbox! The iOS development course here on the LearnAppMaking includes the access to our Swift sandboxes. These Swift sandboxes can be used to code Swift right on your browser.
The IBM Swift Sandbox is sadly not accessible anymore. But you can always use the online.swiftplayground.run by Marcin Krzyzanowski to code Swift in your browser.
Ending the Article:
As mentioned in the above article, it is not necessary to always own the Apple Mac if you want to develop iOS apps. You can even do that by following other measures on your windows PC. You just need to follow the steps carefully and you will face no problems.