A Promising Idea Towards Supporting Plugins for iOS App
Inkdrop, the Markdown note-taking app, for desktop comes with highly extensible plugin system. It allows you, for example, to extend…
Inkdrop, the Markdown note-taking app, for desktop comes with highly extensible plugin system. It allows you, for example, to extend Markdown syntax to add math support, to create new themes, and so on. You can find awesome official and community-made plugins currently available here. Plugins make Inkdrop more powerful and even enjoyable. I’m surprised and so grateful that Inkdrop’s community is making such great plugins, in spite of the fact that this is a small business developed by me, just alone developer. Thank you so much for all your efforts!
Recently I have released the new mobile version, which has been completely redesigned with beautiful UIs with React Native. It has got a lot of features that the desktop app has been providing, but one important feature is still missing — yes, extensibility. What if you could extend the Markdown editor with plugins even on the mobile app? It is definitely great. If you are a student, math syntax support would be important, and with a power of extensibility you can use it on both mobile and desktop, which is very useful. But unfortunately, Apple won’t allow it based on Apple’s App Store Review Guidelines.
I’ve been thinking hard on how I could resolve this big problem for a long time. A few days ago I was walking 14km. A long distance. I was thinking about completely different things but suddenly, I came up with a good idea.
In this article, I’d like to tell you my idea on how to accomplish supporting extensibility on iOS app securely without violating their guidelines.
You Must Use In-App Purchase for Unlocking Features — Apple
First, I would like to clarify about Apple’s guidelines for this case. Plugins are considered as features to unlock within your app. It doesn’t matter if they are free or paid. Apple wants developers to use In-App Purchase for them instead of using their own unlocking system like QR codes and license keys. That is defined in this clause:
3.1.1 In-App Purchase:
If you want to unlock features or functionality within your app, (by way of example: subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use in-app purchase. Apps may not use their own mechanisms to unlock content or functionality, such as license keys, augmented reality markers, QR codes, etc. Apps and their metadata may not include buttons, external links, or other calls to action that direct customers to purchasing mechanisms other than in-app purchase.
Expo Removed QRCode Scanner
Expo, a free and open source toolchain built around React Native, has an iOS app that once offered an ability to run other authors’ apps by scanning QR Code, without installing via App Store. But the ability has been removed recently from the iOS app. According to their blogpost:
Why are you changing those features?
Part of Expo’s mission is to make native app development better. We’d like to make it as easy as possible to test your projects on all your devices. Nonetheless, we had to make these changes in order for Expo Client to conform to the latest Apple Review Guidelines.
So Apple will think that plugins are prohibited as well as Expo’s handy feature. Hm, how to avoid this issue? By the way, Android doesn’t have any limitations like this.
Bundle Them All Into Your App
In a nutshell, you’ve got two problems:
- You can’t download files for a plugin from external sources due to the guideline described above.
- You can’t tell Apple that it is a plugin because it is considered as a feature to unlock.
Well, I would think that the only way to avoid each of them is:
- Bundle all plugins into your app
- Show them as ‘Advanced Options’
Yes, it no longer looks like plugins. Now, how do you accomplish that?
Inkdrop’s Current Plugin System for Desktop
Before talking about my proposal of the plugin system for mobile, let’s take a look at how plugins are delivered to our desktop app. It works just like npm, the package manager for JavaScript and the software registry. Inkdrop provides a plugin repository and a cli tool called ipm (Inkdrop package manager). Users can install a plugin by running ipm install <package_name>
. Then, ipm fetches files via HTTPS from the registry and deploys them into the app. Users also can publish their own plugins to our registry.
Take Advantage of Open Source Workflow
Inkdrop is basically a proprietary product, not an open source product. But as you can see at the plugins page, all plugins out there, including our official plugins are open-sourced. You can reuse our code to make another plugin. I think the equivalent ecosystem can be built even on iOS.
First, we provide a public git repository that will work as a plugin registry. When you made a new plugin, you send a PR to this repository to register your plugin. We review it and once accepted, your plugin will be linked as a git submodule.
When I build the app, I check out the git repository of the plugin registry and bundle them into it. Plugins are shown as advanced options and you can enable/disable each of them anytime. Each plugin’s license is present in the credits screen.
But there are still some points of view to discuss in order to make sure it works securely and comfortably.
Plugins Can Run Only Inside Webview
Inkdrop mobile is built with React Native, which means the app is basically written in JavaScript. So you’d think it is insecure to allow plugins to run on the app because they may access to your personal information stored in your mobile phone. No, that will never happen.
The app comes with a robust markdown editor. It is built on top of web technology, which means that it always runs inside of webview’s sandbox. The editor communicates with the app via postMessage()
. It can know only information regarding currently editing note and doesn’t have access to any other data.
Because of this, you can’t make a plugin that adds any abilities outside of the editor, but it would be sufficient size of scope to be able to extend.
Plugin Size Is Strictly Restricted
The mobile app should be small to keep it lightweight. Plugins could affect the app size since it bundles them all. So each plugin must be small at least less than 100kb~500kb. I need to investigate which size is the best though. It would be tight but necessary. It must also work completely in offline because when you are in offline, obviously your plugin doesn’t work.
Some Plugins Might Be Removed If Less Frequently Used
As number of plugins increases, the app will become fatter. To keep the app size reasonable, your plugin could get removed if it is not often used than others.
Next Step
To make sure if this approach works, I will make some official plugins for mobile and submit new version with them to App Store. Hopefully, it will get approved, then I will write documentations on how to make plugins for mobile!
The plugin support will be planned in the next roadmap.
Development & Debugging
I’ll provide a standalone editor for plugin development, which you can run your plugin from your web browser.
Inkdrop Keeps Evolving, with You
That’s all my idea I have come up with so far. I hope this works it out. Please feel free to leave your comment to discuss about this!
- Inkdrop: https://www.inkdrop.app/
- Subscribe this blog: https://www.devas.life/
- User Forum: https://forum.inkdrop.app/
- Twitter: https://twitter.com/inkdrop_app