Latest 0.1.2
Homepage https://github.com/utiko/StoryboardIdentification
License MIT
Platforms ios 9.0
Authors

Tool which allows you easy instaniate View Controllers from storyboards with autocomplete.
Forget about copy-pasting Storyboard IDs, and keeping them up to date in your code.
Autocomplete will show you only view controllers available by ID on specified storyboard.

StoryboardIdentification

Installation

Using CocoaPods:

  1. Add the following line to your Podfile:
pod 'StoryboardIdentification'
  1. Install pod by running
pod install
  1. Add run script pharse above the "Compile Sources" section
${PODS_ROOT}/StoryboardIdentification/RefreshStoryboardsData.sh
  1. Create empty swift file with name StoryboardIdentifiersUtils.swift at any place of your project as you wish, e.g. at Utils group.
    This file will be automaticaly updated after each storyboard modification.

  2. Build

Usage

Simple create/modify existing storyboards and specify storyboard IDs for View Controllers

Build project.

Now you can instantiacte any view controller in next way:

let vc = ViewControllerClass.instantiate(from: .storyboardNameStoryboard(.viewControllerID))

Example

Create Onboarding.storyboard
Add new View Controller, you can specify custom class for example SignUpViewController.
Specify storyboard ID: SignUpViewControllerID.

Now you can simple call:

let vc = SignUpViewController.instantiate(from: .onboardingStoryboard(.signUpViewControllerID))

If storyboard contains initial view controller, it will be automatically mapped into .initial.

So you can access it by

let vc = OnboardingStartViewController.instantiate(from: .onboardingStoryboard(.initial))

Result Type

You can get a view controller instance of custom type by specifiing it directly.
Or you can simple call UIViewController.instantiate(…) without specifying concrete type.
If specified type doesn’t match real type of View Controller in storyboard, you’ll get fatal error.

Latest podspec

{
    "name": "StoryboardIdentification",
    "version": "0.1.2",
    "summary": "Easy access ViewControllers on your storyboards",
    "description": "Tool which allows you easy acceess your storyboards and instaniate view controllers by autoupdated constants",
    "homepage": "https://github.com/utiko/StoryboardIdentification",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "uTiko": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "swift_version": "4.2",
    "source": {
        "git": "https://github.com/utiko/StoryboardIdentification.git",
        "tag": "0.1.2"
    },
    "source_files": [
        "StoryboardIdentification",
        "StoryboardIdentification/**/*"
    ],
    "preserve_paths": "*"
}

Pin It on Pinterest

Share This