Giter VIP home page Giter VIP logo

autopreviewable's Introduction

image

AutoPreviewable

Summary

Make class inheriting UIView correspond to XcodePreviews.The source code is automatically generated by Sourcery.
This was conceived to introduce StoryboardPreviewsBySwiftUI efficiently.

Usage

Please copy the following files to work in your environment.
You can automatically generate code by executing sourcery_previews.sh.

File description
./Sourcery/sourcery_previews.sh Execution script file
./Sourcery/sourcery.yml Execution configuration file
./Sourcery/templates/AutoPreviewable.stencil Sourcery template file
./setup.sh Required software download script file

If you want to create a preview process, make the class compliant with AutoPreviewable.
The class must be final class.
Note that at this time, auto-generation is only supported for UIView.

protocol AutoPreviewable {}

final class AkkeyView: UIView, AutoPreviewable {
    // do something
}

There is another way to generate using annotations.

// sourcery: AutoPreviewable, xibLess
final class AkkeyView: UIView {
    // do something
}

By default, processing is performed assuming that there is an XIB file with the same name as the class name.
If the XIB file does not exist, specify as follows.

// sourcery: xibLess
final class AkkeyView: UIView, AutoPreviewable {
    // do something
}

To specify the height for previewing, write as follows.

// sourcery: customHeight=100
final class AkkeyView: UIView, AutoPreviewable {
    // do something
}

License

AutoPreviewable is available under the MIT license. See the LICENSE file for more info.

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.