Awful/Awful.app — pull request #306 by nolanw (2014-09-19 06:42:39+00:00)
Title: Smiley keyboard, both in and out of Awful

Since there seems to be some excitement around the smiley keyboard, I thought I'd sketch out some loose plans.

## What is it?

Two things:

1. An easy way to find and insert smileys into posts and messages written within Awful.
2. A way to insert SA smileys into any app, such as Messages.

The first can just be a custom view that we set to our textviews' inputView property. The second requires a [Custom Keyboard Extension](https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/Keyboard.html).

Because these features appear to be very similar, both in the data they work on and the work they do, they will presumably share much functionality.

The emoji keyboard built into iOS 8 is an obvious source of inspiration. We could do worse than to mindlessly copy it.

## Data flow

Since the same Info.plist key gives our keyboard extension both network access and a file container shared with the app, there's no point downloading all the smileys twice (once for the keyboard, once for the app). Whether the app, the keyboard, or both are responsible for downloading and updating the smileys doesn't obviously matter.

The smileys have no relation to Awful's existing Core Data schema, so a simpler means of persistence makes sense to me.

Some sort of "recents" or "favorites" section of the keyboard makes sense. Presumably most people use only a small handful of smileys with any frequency. Syncing those lists across devices via iCloud sounds reasonable, as does syncing those lists between app and extension. I don't know if the app has access to the keyboard's iCloud container, or if the keyboard's iCloud container is even distinct from the app's.

## Prior art

@hardstylle got started on this ages ago in #175. The code there is hopelessly out of date by now, but take a look for inspiration and scraping.

## Potentially useful code

[FLAnimatedImage](https://github.com/Flipboard/FLAnimatedImage) looks like it can handle bulk gif display.