Dev Diary - Bookmark Uploader
We all want to update our websites more often, to write more blog posts. When I did my last big update (a few years ago) I added a bookmarks section, so that I could easily access useful and interesting links from any of my devices without the need for syncing them with an account. This worked well and I have used it but I noticed that even this really simple approach to content still rarely got updated.
So this week, on the trip to and back from Nottingham for New Adventures 2019, I built a tiny tool. An iOS share extension that when clicked in Safari will simply let me put a title and body text on it and it will automatically post it to the correct section of my website.
It isn’t ultra complex, it doesn’t have tagging or any cool features. But it will hopefully make it exponentially easier for me to add a bookmark to my website. It took hardly any amount of time and works, the best kind of little project… one that actually gets done.
The reason I managed to get it finished (to an extent it works anyway) so quickly is twofold:
- GraphQL - By using the Craft plugin CraftQL I was able to instantly get a GraphQL server running that allowed me to read/write to my website. I thought that was going to be the hard bit, writing an API to do it but it was all done for me with the plugin.
- I have done it before - I cheat as much as possible. In this case I was able to take the work I had done on ARBookmarks which lets you share from Safari to ARBookmarks app. So I already had the code for getting the URL, I just needed to figure out (still learning Swift) how to POST to the GraphQL API.