If we want to automate iOS we must first understand the URL schemes and their coding . The URL schemes allow us to do multiple actions with a single hyperlink and between applications. We could consider this to be the queue that links applications in iOS.
In the beginning of iOS this was very simple, but with the amount of apps that take advantage of it today and the diversity of actions that can be done the coding of these actions can be complicated. That’s why we’re going to explain how it works.
The URL scheme
The URL that will execute an action can be divided into three parts: the call , the field , and the query . These are the elements that make up an already encoded URL.
Taking the same analogy as Phillip Gruneich we could consider that the call is a phone number . One application calls the other.
We are going to execute an action in Drafts, so the target application needs to have more information. We’re going to send a letter to Drafts with an envelope with the subject TEXT . It’s very important to note that for each parameter we add we’ll need an envelope . Each envelope is a field.
Finally Drafts picks up the phone and receives the letter . A kind of modern fax. Drafts decodes our letter containing our inquiry. In this case, as I said, it consists of creating a new note in Drafts with the text “Hello Applesence”.
How URL encoding works
Phillip explains it very clearly:
We can also chain more than one field into a single URL by adding a ampersand (&) that acts as a field divider. Most applications will automatically encode text as long as we put it into a key pair.
This is just the beginning. Applications like Drafts will make things easy for us as it incorporates an action editor for different tasks but if we master the basics of the URL schemes we’ll be able to control and automate iOS.