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!
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!
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 informationStoryboardInfo
- 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
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!