Latest 0.2.0
Homepage https://github.com/matteocrippa/StoryboardEnum
License MIT
Platforms ios 8.0, tvos 9.0
Authors

CI Status
Version
License
Platform

Example

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

Usage

First of all make sure that inside your AppDelegate func didFinishLaunchingWithOptions we have this snippet:

window = UIWindow(frame:UIScreen.mainScreen().bounds)

Then you have to create a new enum of type StoryboardEnum.

import StoryboardEnum

enum Storyboard: StoryboardEnum {

    case Main

    var story: StoryboardVC {
        return StoryboardVC(inWindow: UIApplication.sharedApplication().windows.first!)
    }

    var vc: UIViewController? {
        switch self {
            case Main:
            return story.getVC(fromStoryboard: "Main", withIdentifier: "Main")
        }
    }

}

Finally you have only to call wherever you want to present the view controller:

Storyboard.Name.show()

you can even show the vc embedded in a navigation using:

Storyboard.Name.show(inNavigation: true)

IMPORTANT If you plan to omit the identifier of the VC, please check that there is at least one VC set to be Initial view controller in your storyboard to avoid the app to crash.

Extra

I’ve added a nice way to embed a VC in navigationController, using embedInNavigation() func you will received your navigation w/ the view inside.

Installation

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

pod "StoryboardEnum"

Author

Matteo Crippa, @ghego20

License

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

Latest podspec

{
    "name": "StoryboardEnum",
    "version": "0.2.0",
    "summary": "Manage storyboard using a simple enum",
    "description": "An easy way to manage storyboards in your Swift project thanks to Enum",
    "homepage": "https://github.com/matteocrippa/StoryboardEnum",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Matteo Crippa": ""
    },
    "source": {
        "git": "https://github.com/matteocrippa/StoryboardEnum.git",
        "tag": "0.2.0"
    },
    "social_media_url": "https://twitter.com/@ghego20",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source_files": "StoryboardEnum/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This