Latest 0.1.0
Homepage https://github.com/ddhjy/ZZStoryboardReference
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Apple introduces storyboard reference from iOS 9, which provides a placeholder for scene in external storyboard. But due to the version limitation, it’s not that practical. What’s more, it’s not friendly to unit test, which rises the risk of refactoring. ZZStoryboardReference is a alternative of that.

You just need dragging a view controller(called A) scene to the storyboarad, set its class to ZZStoryboardReference, replace the content view with a label, then set the label’s text to another view controller’s (called B) name which can instantiate from storyboard. (I recommend copying the sence in the demo and modify the label’s text) Now A is a place holder of B, We can link segue to A when it’s not convenient for B. In addition, B should override the storyboardName method as the demo shows.

When you want instantiate view controller from stroyboard with hard code:

ZZRedViewController *redVC = [ZZRedViewController newFromStoryboard];
[self.navigationController pushViewController:redVC animated:YES];

What’s more, this mechanism makes unit test for storyboard scene easy. I write a unit test in the demo, when we move a scene for a storyboard to another and forget modifing the storyboardName method, the unit test would rise a exception.

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

ZZStoryboardReference is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'ZZStoryboardReference'

Author

ddhjy, [email protected]

License

ZZStoryboardReference is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "ZZStoryboardReference",
    "version": "0.1.0",
    "summary": "A convenient way to Instantiate view controller from storyboard.",
    "homepage": "https://github.com/ddhjy/ZZStoryboardReference",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ddhjy": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ddhjy/ZZStoryboardReference.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "ZZStoryboardReference/Classes/**/*"
}

Pin It on Pinterest

Share This