For example, while Android apps in the Play Store are well known, iOS is a much more lucrative ecosystem for developers. This is also due to the fact that Apple does not allow anything to be posted on its store, but must be of minimum quality. However, create programs for any platform Apple much more difficult than doing it, for example, on Android, where it would be enough to install Android Studio on the operating system we need.
The perfect thing for create programs for macOS, iOS or whatever platform the apple giant should have a Mac at our disposal. However, when this is not possible, there are a few small tricks that can help us accomplish this task.
Programs for Apple have always been created using Objective-C language and compiled using Xcode tool, a programming environment that can only be run on macOS operating systems. In 2014 Apple wanted to offer users an improved and more modern alternative for building apps for their ecosystem. So that Switft was Was born.
This new programming language much more modern and better prepared to interact with Cocoa, the operating system API Apple… This programming language offers us much clearer, more concise, cleaner and safer code with improved memory management and much higher performance than Objective-C (up to 2.6x) and Python (up to 8.4x).
Switft was originally born as a proprietary language, but since its version 2.0 it has become an open source language with the Apache 2.0 license. Although originally this programming language was also limited to macOS, it is now possible to create and compile programs from Windows…
To do this, we need to download Swift for Windows , an open source tool that allows us to compile this programming language from Microsoft’s operating system. To do this, we just need to create a program using our favorite editor (for example, VS Code), save it as a file with a .swift extension, and open it with the compiler.
This tool already includes the Swift compiler, so we don’t have to download or install anything later. Just click the Compile button and then the Run button to run the newly compiled program in our Windowsif it is compatible.
And if you like, we can also download the latest Swift for Windows and Linux from their website, as well as the ability to compile the programs we have created (albeit by hand).
Install a macOS virtual machine
If we want to program in Objective-C, or if we have problems rendering our Swift programs from other operating systems, then we have no choice but to use macOS. At the moment we have options: create our own hackintosh (which we do not recommend unless we really know how to do it as it is a complicated process), or to place bets on virtual machine is the recommended method.
To mount a virtual machine with macOS, we must install a virtualization program on our computer, for example Virtualbox (for example) and have on hand a virtual hard disk with a previously installed system or at least an ISO from which we can install the system from scratch.
Due to restrictions Apple it is somewhat compiled to start this system from scratch, so we recommend searching the network for virtual machines that have already been created and configured. There are a lot of them, so we shouldn’t have any problems finding them. Plus, they tend to be always up to date and with additional drivers (such as VirtualBox Guest Additions) installed as standard, saving us a lot of work.
It is true that performance will not be as if we had a real Mac, that updates would be more difficult, and that we might have other problems. But it’s a fast and inexpensive solution to build and test our Mac and iPhone apps from a PC with Windows or Linux.
Rent a Mac in the cloud
If all of the above is not enough or we don’t want complications, there is a much faster and easier option with which we can get a Mac without a large investment: rent it in the cloud. Platforms such as MacinCloud or MacStadium are responsible for connecting a series of Macs to the Internet and, in exchange for a monthly fee (which starts at $ 25), allows us to use them without restrictions.
We can opt for a dedicated Mac that allows us to remotely connect to a real Mac via a remote desktop, virtual, which is a virtual machine that they give us access to (which does not run on hardware Apple), and a Mac server specialized in compiling code.
You don’t have to buy an iPhone; do it from xcode
Finally, if we are thinking about creating applications for the iPhone and iPad, we must know that there is no need to invest in this type of device, as we can perfectly simulate it with ” iPhone Simulator “Xcode tool.
Let’s go back to the beginning, of course. Xcode is a unique IDE for macOS and we cannot use it in any way in Windows or Linux. So if we need this emulator, we’ll have to go back and resort to one of the methods we just talked about, be it virtualization, hacking, or renting a Mac in the cloud.