Coder Social home page Coder Social logo

psharanda / nativebook Goto Github PK

View Code? Open in Web Editor NEW
11.0 3.0 0.0 659 KB

A toolkit for Implementing, maintaining, documenting and evolving a shared set of UI components for iOS inspired by Storybook.js

License: MIT License

Swift 72.17% Shell 0.28% TypeScript 14.73% EJS 12.81%
design-system ios snapshot-testing swiftui-previews ui-components uikit uiview

nativebook's Introduction

NativeBook

Intro

Implementing, maintaining, documenting and evolving a shared set of UI components is not an easy thing in a large-scale application. Web developers have created a powerful solution for this process - Storybook.js. But what about native iOS development? Can we achieve a somewhat similar experience?

What if we combine a catalog app, snapshot tests, and HTML-based documentation generation into a single system?

Imagine writing a code snippet just once, and then being able to do the following:

  • Display a view produced from a snippet in a native catalog app
  • Embed a view into SwiftUI previews
  • Run a snapshot test for a snippet
  • Display this code snippet and the resulting snapshot in a generated HTML-based documentation

This repo is a proof of the concept for such a system!

Check my article about NativeBook for more details: https://hackernoon.com/nativebook-unifying-the-native-ios-development-experience-with-storybookjs

Snippet

class UIButtonStories: DynamicComponentStories {
  @objc static func story_ImageTitleButton() -> UIView {
        let button = UIButton()
        var config = UIButton.Configuration.plain()
        config.title = "Image + Title"
        config.image = UIImage(systemName: "bell")
        config.imagePlacement = .top
        config.titlePadding = 10
        button.configuration = config
        return button
    }
   ...
}

Catalog

SwiftUI Preview

Snapshot tests

Documentation

Site: https://psharanda.github.io/NativeBook

nativebook's People

Contributors

psharanda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.