My name is Jake Marsh.
I'm a developer, designer, and writer.

Subscribed via Push Notifications. You can also subscribe via RSS or Twitter.

Subscribe via RSS or Twitter.

Subscribe via Push Notifications, RSS or Twitter.

▸ ComponentKit

ComponentKit takes a functional, declarative approach to building UI. It lets you focus on what your UI should look like, not the steps necessary to build it. It emphasizes a one-way data flow from immutable models to immutable components that describe how views should be configured. It does the heavy lifting of building a view hierarchy from this description.

I've been waiting to play around with this library since I saw this fantastic talk from Adam Ernst and Ari Grant late last year.

There's many pieces to ComponentKit, but one of the most interesting (to me at the moment) is it's declarative layout system:

This is random code I copy/pasted together to show some examples of layout inside ComponentKit. Please refer to their excellent documentation to see the real thing.

    newWithInsets:{.top = 70, .bottom = 25, .left = 20, .right = 20}
                .direction = CKStackLayoutComponentDirectionVertical,
                {[HeaderComponent newWithArticle:article]},
                {[MessageComponent newWithArticle:article]},
                {[FooterComponent newWithArticle:article]},

I've been working in WatchKit quite a bit lately, and I've come to really enjoy it's layout system a lot. It's certainly limiting, but it's fantastic for quickly putting things together when you have an idea. I've been wishing a library would come along that emulated this sort of system for iOS in general, and ComponentKit fits the bill.

Even though some of the ideas and foundations in ComponentKit clash pretty heavily with UIKit's philosophies, I'm encouraged by the pure usability of their system. Even their choice of Objective-C++ as a language was made to make the end-resulting code that uses the library as readable as possible.

It's certainly not meant to be a catch-all and won't be the right choice for every app, but in the cases where it makes sense, ComponentKit seems like a slam dunk.

Vote on Hacker News