I want storyboard simple use.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Storyboardable is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Storyboardable'
outofcoding, outofcoding@gmail.com and bear, mrgamza@gmail.com
Storyboardable is available under the MIT license. See the LICENSE file for more info.
Create an enum that inherits Storyboardable. case is storyboard file identity Storyboard ID.
enum Main : Storyboardable {
case first
case second
case test
}
Use Code
// Get storyboard
let storyboard = Main.storyboard
print("storyboard = \(storyboard)")
// Use storyboard initial ViewController
let initial = Main.initial!
present(initial, animated: true, completion: nil)
// Use storyboard identifier ViewController
let first = Main.first.get
present(first, animated: true, completion: nil)
// Get Information
let test = Main.test
let name = test.name
let identifier = test.identifier ?? "none"
print("name = \(name), identifier = \(identifier)")
// Direct push or present
Main.test.present(self)
Main.test.push(self)
Use Code
let builder = StoryboardBuilder(name: "Main")
let initController = builder.get("test")!
present(initController, animated: true, completion: nil)
let secondController = builder.get("second")!
present(secondController, animated: true, completion: nil)