Computer

So you can program for Apple without having a Mac

For example, although there are many more applications for Android in the Play Store, it is well known that iOS is a much more profitable ecosystem for developers. This is also because Apple does not allow anything to be published in its store, but must have a minimum of quality. However, creating programs for any Apple platform is much more complicated than doing it, for example, on Android, where it would be enough to install Android Studio on the operating system we want.

Ideal for create programs for macOS, iOS, or any other platform of the apple giant is to have a Mac at our disposal. However, when this is not possible, there are some little tricks that will help us carry out this task.

Bet on Swift

Programs for Apple have always been created using the language Objective-C and compiled using the tool Xcode, a programming IDE that can only be run on macOS operating systems. In 2014, Apple wanted to offer users an improved and more modern alternative to create applications for its ecosystem. And so it was born Switft.

This new programming language it is much more modern and is prepared to interact much better with Cocoa, the API of Apple’s operating systems. This programming language offers us a much clearer, concise, clean and secure code, with improved memory management and much better performance than Objective-C (up to 2.6 times) and Python (up to 8.4 times).

Switft was originally born as a closed language, but from version 2.0 of it it became an open source language with Apache 2.0 license. Although originally this programming language was also limited to macOS, now it is possible to create and compile programs without problems from Windows.

To do this, what we must do is download Swift for Windows, an open source tool that allows us to compile this programming language from the Microsoft operating system. To do this, we simply have to create the program with our favorite editor (like 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 won’t have to download or install anything later. Just click on the “Compile” button, and then on the “Run” button to run the newly compiled program on our Windows, as long as it is compatible.

And, if we prefer, we can also download the latest version of Swift for Windows and Linux from its website, also being able to compile the programs we create (although manually).

Install a virtual machine with macOS

If what we want to do is program in Objective-C, or we have problems shaping our programs in Swift from other operating systems, then we have no choice but to go through macOS. At this point, the options we have are either build our own hackintosh (something that we do not recommend unless we really know how to do it, since it is a complicated process), or bet on a virtual machine, the recommended method.

To mount a virtual machine with macOS, what we must do is install a virtualization program on our computer, as is the case with VirtualBox (for example), and have at hand a virtual hard disk with this system previously installed, or, at least, an ISO from which we can install the system ourselves from scratch.

Due to Apple restrictions, 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 many, so we shouldn’t have a problem finding them. In addition, they are usually always up-to-date and with additional drivers (such as VirtualBox Guest Additions) installed as standard, which will save us a lot of work.

Install VMware Tools on macOS - 8

It is true that the performance will not be the same as if we have a real Mac, that the updates are more complicated and that we may have some other problems. But it is a fast and inexpensive solution to be able to create and test our applications for Mac and iPhone from a PC with Windows or Linux.

Rent a Mac in the cloud

If all of the above is not enough, or we do not want complications, there is a much faster and easier option with which we will be able to have a Mac without having to make a large investment: rent it in the cloud. Platforms like MacinCloud or MacStadium They are responsible for connecting a series of Mac computers to the Internet and, in exchange for a monthly fee (which starts at $ 25), they allow us to make unlimited use of them.

We can opt for a dedicated Mac, which allows us to connect to a real Mac remotely through a remote desktop, a virtual one, which is a virtual machine to which they give us access (which does not run on hardware of Apple) and a Mac server, specialized in code compilation tasks.

You don’t have to buy an iPhone; do it from xcode

Finally, if we are thinking of creating applications for iPhone and iPad, we must know that it is not necessary to make an investment in this type of device, since we will perfectly be able to emulate it from the tool «iPhone Simulator»From Xcode.

Of course, we go back to the beginning. Xcode is an exclusive IDE for macOS, and we cannot use it in any way on Windows or Linux. Therefore, if we need this emulator, we will have to go back and resort to one of the techniques that we have just talked about, be it virtualization, a hackintosh or renting a Mac in the cloud.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *