Skip to content

Instantly share code, notes, and snippets.

@muukii
Last active May 31, 2021
Embed
What would you like to do?
Storybook-ios demo app starter template
import UIKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let newWindow = UIWindow()
newWindow.rootViewController = RootContainerViewController()
newWindow.makeKeyAndVisible()
self.window = newWindow
return true
}
}
import StorybookKit
import StorybookKitTextureSupport
import TextureSwiftSupport
let book = Book(title: "MyBook") {
BookText("Hello, MyBook")
}
import StorybookKit
import StorybookUI
import UIKit
final class RootContainerViewController: UIViewController {
init() {
super.init(nibName: nil, bundle: nil)
let child = StorybookViewController(
book: book,
dismissHandler: nil
)
addChild(child)
view.addSubview(child.view)
child.view.frame = view.bounds
child.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment