Prefire

screenshot of Prefire

A library based on Xcode Preview, for easy generation: Playbook view, Snapshot and Accessibility tests. SwiftUI and UIKit supported!

Overview

Prefire is a tool that enhances the functionality of SwiftUI Preview. It provides automatic generation of code and tests based on Sourcery and swift-snapshot-testing. With Prefire, developers can easily generate playbook views, snapshot tests, and accessibility snapshot tests. It can be installed as an Xcode Project plugin or as a Swift Package Manager plugin.

Features

  • Easy to use: Prefire simplifies the process of generating code and tests for SwiftUI Previews.
  • Automatic generation: Code and tests are automatically generated based on Sourcery and swift-snapshot-testing.
  • Generation Playbook (Demo) view: Prefire allows you to generate playbook views for showcasing demo views.
  • Generation Snapshot tests: Snapshot tests can be generated using swift-snapshot-testing.
  • Generation Accessibility Snapshot tests: Accessibility snapshot tests can also be generated.
  • Xcode Plugin supported: Prefire can be installed as an Xcode Project plugin.
  • Swift Package Plugin supported: Prefire can also be installed as a Swift Package Manager plugin.

Xcode Project Plugin

  1. Add Prefire as a package dependency to your project without linking any of the products.
  2. Select the target to which you want to add linting and open the Build Phases inspector.
  3. Open Run Build Tool Plug-ins and select the + button.
  4. From the list, select PrefirePlaybookPlugin or PrefireTestsPlugin, and add it to the project.

Swift Package Plugin

  1. Add Prefire as a package dependency to your Package.swift file.
  2. Add Prefire to a target using the plugins parameter.

Summary

Prefire is a tool that enhances SwiftUI Preview by providing automatic code and test generation. It simplifies the process of creating preview views, snapshot tests, and accessibility snapshot tests. Prefire can be installed as an Xcode Project Plugin or as a Swift Package Manager Plugin. It is useful for developers who want to quickly generate code and tests for their SwiftUI Previews.