Recap of My Recent Github Goodies
Under the influence of Bryan Irace, an iOS engineer at Tumblr, I’ve open-sourced a lot of handy iOS utilities lately. These are all polished, single-purpose units of code which should be cake to drop into your projects.
JTSImageViewController is like a “light box” for iOS. It’s similar to image viewers you may have seen in apps like Twitter, Tweetbot, and others. It presents an image in a full-screen interactive view. Users can pan and zoom, and use Tweetbot-style dynamic gestures to dismiss it with a fun flick. Don’t force your users to learn yet another set of gestures. Tweetbot’s are the best and should become the canonical reference.
JTSCursorMovement adds convenient gesture recognizers to a UITextView that make it easy to move the cursor forward or backward. Use one finger to move by characters, two fingers by words, and three fingers by paragraphs. JTSCursorMovement works with both plain text and attributed text, and with composed characters like emoji. I use this in all my apps. I wish every app used it.
JTSSmartPunctuation replaces common shorthands composed of dumb punctuation with their smart counterparts. It turns dumb quotes into smart quotes, three consecutive periods into an elipsis, three consecutive dashes into an em-dash, and two consecutive dashes followed by anything but a dash with an en-dash. It’s compatible with right-to-left languages and safe to use with composed character sequences, like emoji. It only scans the immediate vicinity around recent edits, so it should perform well even with very long runs of text.
JTSSemanticReload is a category method on UITableViewController for calling “reloadData” while preserving semantic content offset. Many times you don’t want to use an animated table view update, but you do want to insert new rows above the current content offset. The problem with using reloadData is that it loses the user’s current place in the content. In these situations, use the JTSSemanticReload category instead.