Last active
May 31, 2021 12:44
-
-
Save muukii/482d45d91afe4c362882e05082baa621 to your computer and use it in GitHub Desktop.
Storybook-ios demo app starter template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StorybookKit | |
import StorybookKitTextureSupport | |
import TextureSwiftSupport | |
let book = Book(title: "MyBook") { | |
BookText("Hello, MyBook") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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