Installation.md
June 7, 2026 Β· View on GitHub
π¦ Installation
Supports:
- β
SPM Plugin (
Package.swift) - β Xcode Build Tool Plugin
- β
CLI (
brew install prefire) - β GitHub Actions / CI
Xcode Build Tool Plugin
You can integrate Prefire as an Xcode Build Tool Plug-in if you're working on a project in Xcode.
- Add
Prefireas a package dependency to your project. You donβt need to link any of the products directly.
- Create or select a unit test target. Snapshot tests will be generated into this target.
π‘ If your project doesn't have a test target yet, create one via "File β New β Target β Unit Testing Bundle".
-
Select the target to which you want to add linting and open the
Build Phasesinspector. -
Locate
Run Build Tool Plug-insand click the+button. SelectPrefireTestsPluginfrom the list. -
When you build this target β even if itβs empty β Prefire will scan your sources and automatically generate snapshot tests for all previews.
You can also attach PrefirePlaybookPlugin to another build target to generate preview-based component models.
Swift Package Manager Plugin
You can integrate Prefire as a Swift Package Manager Plug-in if you're working with a Swift package using a Package.swift manifest.
- Add Prefire as a package dependency:
dependencies: [
.package(url: "https://github.com/BarredEwe/Prefire", from: "4.0.0")
]
- Add Prefire plugins to your targets:
.target(
plugins: [
// For Playbook (Demo) view
.plugin(name: "PrefirePlaybookPlugin", package: "Prefire")
]
),
.testTarget(
plugins: [
// For Snapshot Tests
.plugin(name: "PrefireTestsPlugin", package: "Prefire")
]
)
- When you build the test target, Prefire will automatically generate snapshots.
Command Line Interface (CLI)
Prefire provides a command-line interface for generating snapshot tests from your previews.
Installation
Download Prefire from brew:
brew tap barredewe/prefire
brew install prefire
Usage
prefire tests
prefire playbook
Use --help with any command to see available options:
prefire tests --help
prefire playbook --help