Ink iOS Documentation
The Ink Mobile Framework is straightforward to integrate. The following tutorial
outlines the four major steps required.
First, you'll need to add the required dependencies and add your application as a receiver of the appropriate URL types.
Second, you'll need to setup a small amount of Ink setup code.
Third you'll enable a view to activate and transmit data to the Ink Framework.
Finally you'll enable your view to receive actions from other apps. The framework is easy to integrate with. Typical integrations take about two to three hours from start to finish.
1. Setup the XCode Project
Then, drag and drop the INK.bundle and INK.framework into your project.
In your project's Build Settings, set Other Linker Flags to be
-lz (If you don't see it, make sure you’re viewing "all", not "basic").
In your project's Build Phases, under Link Binary With Libraries, add the following:
Now that the frameworks are in place, we'll configure your app. The first thing is to add a url scheme that is "ink-<yourappkey>". For instance, if your app key was "A12a93533ba3z", you would need to add the url scheme "ink-A12a93533ba3z" to your app.
To add url scheme, go to the project summary view of your app, select
Info. At the bottom, locate
Url Types. Add a new URL scheme. Set
Schemes to be
be the URL identifier, eg.
com.inkmobility.ThatCloud. When you're done, it should look like this:
2. Add Baseline Code
Import the framework into your application delegate
Initialize Ink inside your app delegate's
Finally, add in the line that allows Ink to receive and dispatch the appropriate actions for your app in your app delegate's
3. Enable a view to transmit
Now that you've set up the housekeeping bits, it's time to “Ink Enable” a view. An Ink-enabled view allows you to transmit content from your app into the Ink framework, allowing it to communicate and work together with other Ink-enabled apps.
Import the framework
When you enable a view for Ink, it will respond to the 2-finger double-tap gesture
by bringing up the Ink workspace. When you enable a view for Ink, you will also provide the
content your application is sending. This content, as well as the metadata of the content
like it's UTI and filename, are bundled in an
The simplest way to enable a view to work with Ink is as follows:
In some situations, the full content associated with the view is not available when the view is loaded. In this case, you can provide a block instead which will be called asynchronously on a background thread when the Ink workflow launces.
The above example also incorporates a return block. It's often convenient to
have the context in which Ink was enabled when it comes to handle the return action.
A return block lets you capture any state you may need for when it comes time to
return, for example, the save location of the file. If you prefer to handle return actions
in a more centralized fashion, you can register handlers for return actions just as you would for
any other action with the
[Ink registerAction:] family of commands.
4. Receive Actions
Once you've decided what endpoints you want to receive, you'll need to wire up the handlers for those actions.
To do so, register your actions in your app delegate's
A few notes on registering actions:
You can register multiple handlers for the same action. They will each be called, but the order is nondeterministic.
You don't need to register handlers for direct return actions. Your callback will be called automatically. If you do register a handler, it will be called as well.
Deciding which methods to fire is done by comparing the registered actions with the action taken by the user. Actions are keyed on their name and type, so note that spaces and capitalization matter.
Once the user has completed the action they set out to do, they expect to be able to continue their workflow. When the action is finished, you can launch the Ink workflow to allow the user to return via the following code:
To learn more about registering actions and how to test out your inbound actions, see the developer guide.