Skip to content

🪄`LivePreview` support

Latest
Compare
Choose a tag to compare
@MihaelIsaev MihaelIsaev released this 18 Dec 01:49
· 22 commits to master since this release

Live preview

To make it work with live preview you need to specify either all styles or exact autolayout's one

With all app styles included

class Welcome_Preview: WebPreview {
    override class var title: String { "Initial page" } // optional
    override class var width: UInt { 440 } // optional
    override class var height: UInt { 480 } // optional

    @Preview override class var content: Preview.Content {
        // add styles if needed
        AppStyles.all
        // add here as many elements as needed
        WelcomeViewController()
    }
}

With exact app styles including autoalyout's one

class Welcome_Preview: WebPreview {
    override class var title: String { "Initial page" } // optional
    override class var width: UInt { 440 } // optional
    override class var height: UInt { 480 } // optional

    @Preview override class var content: Preview.Content {
        // add styles if needed
        AppStyles.id(.mainStyle)
        AppStyles.id(.autolayoutStyles)
        // add here as many elements as needed
        WelcomeViewController()
    }
}