Latest 0.1.0
License Apache
Platforms ios 7.0, requires ARC

[![CI Status]( Bachrach/HNDCreatableViewController.svg?style=flat)]( Bachrach/HNDCreatableViewController)

What is HNDCreatableViewController

We often want to construct View Controllers that we designed in Storyboards. If you want to load these View Controllers, you need to tightly couple your code that creates the View Controller to know which Storyboard hosts the View Controller. Using HNDCreatableViewController, we store that information directly in the View Controller, so that other parts of our application can simply create a View Controller without having to know which Storyboard implements it.

Consider a MyAwesomeViewController, which is designed inside the Awesome.storyboard and has a View Controller Identifier of TotesAwesome.

We define our MyAwesomeViewController to conform to HNDCreatableViewController:

#import <HNDCreatableViewController/HNDCreatableViewController.h>

@interface MyAwesomeViewController : UIViewController <HNDCreatableViewController>


We then implement MyAwesomeViewController and define its Storyboard and View Controller Identifier:

#import <AtSugar/AtSugar.h>
#import <AtSugarMixin/ASMixin.h>

@implementation MyAwesomeViewController

@mixin (MyAwesomeViewController, HNDCreatableViewControllerMixin)

@declare_class_property (viewControllerStoryboard, @"Awesome")
@declare_class_property (viewControllerIdentifier, @"TotesAwesome")


We used AtSugar and AtSugarMixin to make the implementation short and to the point.

That’s it. Now if you want to create a MyAwesomeViewController from somewhere else in your code, you can just do:

MyAwesomeViewController* vc = [MyAwesomeViewController create];
[self presentViewController:vc animated:YES completion:nil];


HNDCreatableViewController is available through CocoaPods. To install
it, simply add the following lines to your Podfile. Note: we recommend using AtSugar and AtSugarMixin, so add it to your Podfile as well.

pod "HNDCreatableViewController"
pod "AtSugar"
pod "AtSugarMixin"


Dustin Bachrach, [email protected]


HNDCreatableViewController is available under the Apache License 2.0. See the LICENSE file for more info.

Latest podspec

    "name": "HNDCreatableViewController",
    "version": "0.1.0",
    "summary": "Creatable view controllers",
    "homepage": "",
    "license": "Apache",
    "authors": {
        "Dustin Bachrach": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "platforms": {
        "ios": "7.0"
    "requires_arc": true,
    "source_files": "Classes/**/*.{h,m}"

Pin It on Pinterest

Share This