StoryboardKit 0.5.8

StoryboardKit 0.5.8

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Aug 2016
SPMSupports SPM

Maintained by Ian Grossberg.



  • By
  • Ian G

StoryboardKit

StoryboardKit a simple OSX library that tells you all you would want to know about storyboard files.

Currently it supports iOS storyboards only. OSX storyboard support forthcoming!

Installation


StoryboardKit is available through cocoapods, to install simple add the following line to your PodFile:

  pod "StoryboardKit"

Alternatively you can add the github repo as a submodule and use StoryboardKit as a framework.

Carthage support soon!

Setup and Usage


The library uses two “root” level objects to provide the tree of information you’ll need:

  • ApplicationInfo - contains all information global to your application such as class information as well as instance information
  • StoryboardInfo - contains all information specific to a particular Storyboard file

To parse a Storyboard file:

    var applicationInfo = ApplicationInfo()
    var storyboardInfo = StoryboardFileParser.parse(applicationInfo!, pathFileName: "Main.storyboard")

From here you can access things like the list of all ViewControllerClassInfos or ViewControllerInstanceInfos in the app through your ApplicationInfo instance

    for viewControllerClass in application.viewControllerClasses {
        ...
    }

Or perhaps you’ll traverse through your Storyboard graph via the StoryboardInstanceInfo’s initialViewController or scenes list.

    guard let initialViewController = storyboardInfo.initialViewController else { ... }
    guard let initialView = initialViewController.view else { ... }

    guard let subviews = initialView.subviews else { ... }

    for subview in subviews {
        ...
    }

To learn more about the information StoryboardKit currently parses please read the docs here: cocoadocs.org

To see an example of StoryboardKit in use check out the seguecode repo here: seguecode

Contributing

If you have any ideas, suggestions or bugs to report please create an issue labeled feature or bug (check to see if the issue exists first please!).

Or submit a pull request, there is a lot more work to be done!