Do I need a mac to program iOS?
How to program iOS on Windows?
If an iPad Pro can take the role of a traditional computer, like what Apple promote on its “What’s a computer” campaign, then other iPad models can also be a “computer”, since the differences between models aren’t that big anyway. By extension the iPhone can also fulfill that role with the help of an external keyboard. Although ergonomically speaking, maybe only the plus-sized iPhones can reasonably do it.
This includes programming on it. A general purpose computer can only be called “general purpose” only if it can be made to compute what the user needs it compute. Which often means programming it. Without such capability, a device with a CPU may fall into the realm of special-purpose computers and embedded systems. Things like game consoles or ye olde word processors.
Indeed in the early days of iOS, this wasn’t possible. Apple laid out rules that made it impossible to program iOS on the device itself, effectively preventing it from being a general purpose computer. That’s why many people thought iOS is “just for toys” – limited purpose devices not unlike gaming consoles or glorified pocket calculators, because users can’t program on it.
However that’s a thing of the past. Apple has relaxed its App Review Guidelines to allow programming applications on iOS and the App Store. Better yet, it also provides an app specifically for programming on iOS.
“Wait, it’s possible to program iOS on itself?” you might exclaim.
Yes. Just like the good old days of the PC revolution when the unwashed masses bought computers to program it (and maybe also play a game or two). Citizen programming is now a reality on the iPad, iPhone, and iPod touch. There are some caveats involved, but those shouldn’t block the enthusiastic amateur from writing and distributing code.
In the rest of this article, I’ll list down some of the better tools to write software on iOS. This is by far not a comprehensive list, but the tools that I have experience of using myself and found to be useful. The list is roughly in the order of intensity: from casual, to business, and up to semi-professional. I deliberately exclude Xcode, the obvious standard for iOS development, in this list. Likewise its competitors or other tools intended towards professional programmers.
Apps to Learn (or Teach) Programming
This section talks mostly about apps for learning programming, teaching programming, or even having some fun by programming. In other words, programming for the sake of programming – not to accomplish some other task.
Many informal education centers uses ScratchJr as the tool to introduce programming concepts to children around 5-7 years of age. Its programming paradigm revolves around scenes containing objects that can be programmed to move, play sounds, or react to certain stimulus. Objects can also signal each other, or even cause scenes to change.
Those education centers tend to direct children to use ScratchJr as a story-telling tool. That is, kids are taught to “tell a story” using the application, with a few interactive elements. For example, creating a farm scene with a barn, a sheep, a horse, and a chicken. Tapping on an animal would make the corresponding animal sound.
Interestingly our six year old son made a soccer game usng ScratchJr. Its rather unresponsive, but kind of worked. Until he discovered Minecraft – but that’s another story ^_^
If you’ve ever heard of Hypercard from the Classic Mac era, ScratchJr is probably its spiritual successor. Sans the programming language and database support. Another analog would be a Keynote-like application but for creating interactive fully-graphical presentations instead of bullet points.
ScratchJr is really a simplified version of Scratch, another application for teaching programming to very young children. This “bigger brother” adds variables, conditionals, and some other things that may merit Turing-completeness. However Scratch is only available for web browsers – I don’t know if it has a downloadable offline version.
ScratchJr is available for iOS, Android, and the Chrome Web Store. There’s also an unofficial desktop port for macOS and Windows.
7 Billion Humans
Technically 7 Billion Humans is a game and not a programming toolkit. However you play the game by writing programs in its own programming language. The programming language is simple yet runs on multiple “computers” in parallel. This alone may make the game to be a good introduction to assembly language for parallel processors. Since these multiple “computers” are game-drones, perhaps it can be a good introduction to robotics for the layperson.
In this game you play as a manager who scripts out instructions for his/her underlings – which are corporate drones who follows instructions without question. Each level is typically about controlling a number of workers placed in different locations in a two-dimensional playing field to complete a pre-determined goal. You can only write one program in each level and all workers executes the same program at slightly different speeds, from their respective starting points scattered throughout the playing field. Therefore your program would need to be generic enough so that all workers with distinct starting points can execute and accomplish the common goal.
The programming language instructions are very simplistic. Some example instructions are move left, pick up box, store value into memory slot 1. Control structures are limited to branching and jump (yes, the dreaded
GOTO is back) but none of the modern programming language constructs like for loops. This is why I said it is similar to assembly language, the family of programming languages that are translated directly into the instructons which the processor executes.
Besides iOS, 7 Billion Humans can also be played on macOS, Windows, Linux, and Nintendo Switch.
The app has two modes of operation:
A computational notebook interface where you enter free-form Swift code and have the results shown in-line or in the right pane of its screen.
- Playground Books.
A guided fill-in-the-blanks mode where you download pre-made playgrounds and write Swift code in the blank areas provided by its author.
You can create your own Playground documents from within the app. But you can’t create Playground Books just by using the app alone. As of this writing, Playground Book authoring would require Xcode and thus a mac.
The Playground mode is also useful to test or prototype various Swift snippets that can be copy-pasted into an iOS app. You no longer need to go to the overhead of creating an entire Xcode project just to try out ten lines of code.
As a professional software engineer, I also find Swift Playgrounds useful for delivering small technical demos and re-producing platform bugs for technical support. If these were done using an Xcode project, there would be several files that needs to be included but not relevant to the issue at hand. I.e. “overhead files” such as the
.xcodeproj bundle needed to define a project and
Info.plist needed to build an iOS application.
Swift Playgrounds is available for both iOS and macOS.
Productivity and Automation
If you’re doing serious business, there are probably a few repetitive tasks that are part of your business process. By extension if some of these workflows are done on your iOS device then there’s a good chance you would need to do some mundane activities on it.
This section focuses on automation: applications that can be programmed to automate certain repetitive tasks or to extend its function to fulfill some of your workflow’s very specific needs. These are not programming applications per se, but programmable applications.
Shortcuts was an acqui-hire of the Workflow app, which primary purpose is to orchestrate other iOS applications to accomplish a workflow. The original app won an Apple Design Award in 2015, acquired by Apple in 2017, and finally integrated into iOS 13.
Shortcuts should work well when your scripts are simple and if the apps that you use supports being controlled by it. These orchestrate-able apps typically has a well-known custom URL scheme or supports the Callback URL open standard. On top of that, Shortcuts has a good number of built-in actions. Some examples are sending messages, speaking text (text-to-speech), even running commands in a remote server via
However its workflows aren’t usually good for any moderately intensive data processing. There’s no built-in parallelism and not much support in its scripting libraries for anything moderately complex. The scripting engine is also not exactly built for performance.
Furthermore its flowchart-based graphical interface also becomes a hindrance when you have a lot of steps in your workflow. What’s the upper bound for a lot? I’d say around 20 steps or so and a Shortcuts workflow would begin to be hard to maintain or debug.
LifeWire put together a number of Shortcuts workflows that you can readily use or take as an inspiration in automating your own workflows.
If you haven’t heard of OmniGroup, it is one of the long-standing vendor of mac software since the first version of Mac OS X (and slightly before that). The company is known mostly for its diagramming software, OmniGraffle. On top of that it also produces a to-do application (OmniFocus), an outliner (OmniOutliner) and a project management software (OmniPlan). Its iOS apps started with the launch of the iPad and nowadays most apps are available on iPhone as well.
Some examples of automation would be:
- Enriching a map with data from external sources (OmniGraffle provides maps of US states as well as shapes of other countries’ territories).
- Enrich an OmniOutliner outline with data from external sources and have it updated automatically.
- Generate a diagram from an external source (perhaps a database) as its starting point
The ecosystem is big enough, there’s a third party site dedicated to automation in OmniGroup apps: Omni Automation. In that site you can find tutorials, sample scripts, even step-by-step instruction on creating plug-ins for these apps.
Tap Forms is a relational database application. Somewhat similar to the (now-dead) Bento or maybe Microsoft Access. Although I have to say its feature set is nowhere near Microsoft Access. For example, there is no SQL support, often useful for creating some advanced reports.
Nevertheless if you have tabular data that are frequently updated, Tap Forms would be a great step up from a spreadsheet. Entering new data would be much easier. So will be slicing, dicing, filtering, and making reports from that data would be so much easier than keeping multiple tables with hundreds of rows each in a spreadsheet application.
Some sample usages for the application would probably include home inventory, personal collection, or managing data of a sole proprietorship business. Tap Forms supports synchronization of data between devices. However the application is not multi-user – there is no access control features. If you synchronize a database between devices belonging to different users, nothing can stop those other users from corrupting your data.
Automation is so much important to Tap Forms, the company runs its own forum about scripting.
Make Real Apps
This is the semi-pro section. The development tools listed here allows you to create apps that can be put on sale in the App Store. Develop on an iOS device and when you are done, upload it to the app store.
Of course you would still need a mac (along with Xcode and a paid Apple developer account) for final packaging and upload. But this is likely a one or two hour task after you are familiar with the process. Therefore you can probably rent a mac by the hour just for the task of packaging and uploading the application.
When you already know Python and looking to make iOS applications, consider Pythonista, a “full blown Python IDE for iOS”. Complete with debugging, variable watch, syntax completion, built-in documentation – pretty much all what you expect from an IDE (Integrated Development Environment). The app has been around for many years now, probably just before the time when Apple officially allowed programming on iOS. On first launch its capabilities were severely limited by App Review policies. One big limitation was the inability to import any programs into the environment, therefore typing it in was the only way to run 3rd party Python applications (similar to how home computing was in the early 1980s). However that limitation has been long lifted. You can now import Python scripts written elsewhere via the Files app and similarly copy scripts you’ve written in Pythonista for use in other computers.
With Pythonista you can create full-blown applications or special-purpose applications for your own productivity. It has libraries for interfacing with iOS’ native API, so you can create GUI applications, as well as its own GUI toolkit and designer. Besides applications and scripts, you can also create share extension handlers (to process data taken from other applications) or custom-made a Today widget.
Pythonista has a generous set of pre-installed libraries like
SymPy. It also has a number of modules developed exclusively for working with iOS such as access to the contacts database or Bluetooth peripherals. You can install other Python packages as long as those are “pure Python” – doesn’t install any native libraries or dependent on external interpreters or utilities.
However as an IDE, Pythonista lack support for projects. There is no support for a coherent set of scripts treated as a unit and would be built as a single application. Similarly there is no per-project
requirements.txt nor any virtual environment mechanism so that different projects may have their own respective dependencies. All installed packages are global with respect to the Pythonista installation.
Pythonista scripts also inherits all limitations normally imposed to all iOS applications. Which includes no subprocesses (which limits the way you can do multiprocessing), sandboxed access to files, and no paging file (which severely limits the amount of memory you can use).
Deployment to App Store is done through an Xcode App Template provided by Pythonista’s author. In short, you export your Python scripts and embed it inside an Xcode project. Then you use Xcode to build that project into an app and upload it to the App store.
Pythonista is available for iPad, iPhone, and iPod touch. Yes, you can write and run Python scripts on a phone.
When you have a gameplay in mind, consider Codea as your prototyping tool. Better yet, it can probably take you from prototype to production – as in the App Store.
Codea is designed to make graphical games. The app uses Lua as its core language packed with a lot of libraries, tools, even stock sprites and sound effects to get you up to speed quickly. There are built-in libraries for sprite animation, physics, 3D voxels, and much more.
However Codea may take a bit of adjustment if you’re not used to programming games. It borrows an animation-centric paradigm from Processing where your code is called once per screen update.
A Codea game centers around two top-level functions
setup– Called only once at program start to initialize variables.
draw– Called on every frame to re-fresh the display.
That’s just about it. You would need to ensure whatever processing you do including your drawing code completes within 16 milliseconds. Otherwise your game would stutter.
When it comes to deployment time, Codea provides an official Xcode template project containing the runtime library and built-in assets. The idea is to copy your Codea project into a copy of this Xcode project. Then use Xcode to build the app and upload to the App Store.
As you can see different apps have their own uses, strengths, and weaknesses. You would need to have a good idea what are you trying to achieve and how much learning challenge are you willing to take before you choose which tools to use.
When you have a specific workflow that you do repetitively and could use automation, try Shortcuts.
Similarly if this workflow includes an OmniGroup application, see if their automation feature can help you.
However if you need to manage lists of things that are frequently updated, have a look at Tap Forms.
Especially if you are currently using a spreadsheet to manage these and the amount of data there is starting to become large and difficult to maintain. Tap Forms has a CSV import and export feature, so you can migrate textual tables relatively easy.
If you want to learn programming or curious how iOS apps are put together, consider going with Swift Playgrounds. It has tutorials for you to begin learning programming yet you can use it to develop simple iOS utilities.
But if you want to introduce programming to very young children (around ages 4–8), you should use ScratchJr to introduce these concepts. Nevertheless, motivated nine year olds nowadays could probably go right through Swift Playgrounds. Too young? There are nine year old iOS developers and 10 year old WWDC attendees nowadays. I started at age 12 myself, but it seems intelligence inflation is happening, allowing programming skills to be picked up by even younger children.
If you already know Python, go ahead with Pythonista. It provides libraries to make both games and regular GUI applications, in addition to standard command-line style apps.
But if you’re itching to make your first game (and haven’t invested deeply into Swift or Objective-C – iOS’ default programming languages), have a look at Codea. It has pretty much everything you need to create a game and then some.