What I Learned Writing a Playground Book

I’m in the process of writing a Playground Book and with about ninety percent done, the last ten percent is really dragging out and taking more time than I anticipated. So to get some extra motivation, I thought I’d take a short break and talk about some of the things I learned while writing the book. If you’re not familiar with Playground Books then you can get caught up by reading the highlight page from Apple or watching the introductory video from WWDC. >>>

Making Assessments in Swift Playgrounds

Available in the iOS 10, the Swift Playgrounds app allows you to author and consume playgrounds on your iPad. The app was previewed at WWDC and given it’s own dedicated session during the week. For the past few weeks, I’ve been working off the Starter project provided by Apple in order to experiment with creating a Playground book. Because the app hasn’t been officially released and it’s still in beta, there isn’t much documentation available at the moment– this has made some parts of the process more challenging. >>>

Building an NSIncrementalStore

NSIncrementalStore subclasses provide control over the persistence layer of Core Data and allow you to dictate how entities are stored and deleted, by providing a translation layer between Core Data and your data store. First introduced in 2011 at WWDC, Incremental Stores have been slow to catch on and (historically) difficult to grok. However, the official documentation has gotten much better and great resources have been provided by the community; consider both The future of web services in iOS / Mac OS X and Accessing an API using CoreData’s NSIncrementalStore required reading before implementing your own. >>>

A Swift Introduction to Core Data

Ever since Swift was released into the wild at WWDC, I’ve been eager to get my hands on it and start learning. While the language has been easy to pick up, using it with the Cocoa framework has been bumpy at times. I am sure this is because of the learned habits of being fast and loose with types. One of the most interesting new features in Xcode 6 are Playgrounds. >>>

Custom View Transitions on iOS 7

iOS 7 introduced a new way to build custom transitions between views and it’s now fairly easy to create complex animations for navigation or segue events. The built-in containment view controllers have been outfitted for use with transition APIs, including UICollectionViewController which sports a new useLayoutToLayoutNavigationTransitions property. This property allows two UICollectionViews to animate between layouts within a navigation stack. There is sample code from Apple and Stack Overflow posts detailing how use this property. >>>

Adding a ReactiveCocoa networking layer

I started using some ReactiveCocoa in my network layer after learning more about it recently. There are several good articles including one by Chris Trott titled How I Wrote Vinylogue for iOS With ReactiveCocoa. This is a fantasic geek article and includes details about how he incorporated ReactiveCocoa into the different layers of Vinylogue. The network approach I took is adapted from his and similar to this one by Prabir Shrestha. >>>

Implementing drawRect with UIPopoverBackgroundView

Recently I found myself styling a UIPopoverView. I wasn’t content with the results setTintColor: was giving me and I didn’t wish to use a Photoshop approach. Instead, I tried achiving the effects I wanted by subclassing UIPopoverBackgroundView and using Core Graphics to draw. Here’s what I came up with. I started by subclassing UIPopoverBackgroundView and implementing the arrowHeight, arrowWidth and contentViewInsets methods. The arrowHeight and arrowWidth methods return the height and width of the popover arrow while the contentViewInsets method returns UIEdgeInsets denoting how much the popovers contents should be inset from the outside edge. >>>

Using Mantle with Core Data

I recently started using Mantle in some new projects. I had been following the framework for awhile and watching the Core Data adapter pull request. That pull request was recently merged and I’ve since been using Mantle to create Core Data entities using JSON from an HTTP response. This makes it really easy to take JSON and transform into managed objects persisted in your object store. Here’s how I am doing it. >>>

Simple News Reader App

Over the past few days I’ve spent time developing a news and comment reader for Hacker News. I created it for personal use and to scratch my development itch. There are quite a few existing apps for reading hacker news, some quite good, but I myself am a hacker and so why not create something? Before I get into the details, I want to make a few points. First, Hacker News gets a lot of traffic and it’s not cool to punish the web servers with an insane amour of requests. >>>

Calendar Controls on iOS

When developing GrowJo I investigated two open source calendar solutions for iOS; Tapku and Kal. The Tapku library includes way more than just a calendar but I elected to use a stripped down version of the library with only the components needed– Tapku can do this because of its modular design. I really liked the code behind Tapku more and it fit nicely into the existing Cocoa setup, especially the month table view. >>>

UINavigationBar and method swizzling

You don’t have to use many iOS apps before you realize that several deviate from the standard gray/blue look and feel. Facebook, yelp, and zipcar all use different colors on the UINavigationBar to provide a unique look. When writing my own apps I wanted to do something similar. You can set the tintColor of the navigation bar or customize the UI further by using an image as the background. Check out UIAppearance for a more modern solution. >>>