Supports:
- ✅ SPM Plugin (
Package.swift) - ✅ Xcode Build Tool Plugin
- ✅ CLI (
brew install prefire) - ✅ GitHub Actions / CI
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.
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.
Prefire provides a command-line interface for generating snapshot tests from your previews.
Download Prefire from brew:
brew tap barredewe/prefire
brew install prefireprefire tests
prefire playbookUse --help with any command to see available options:
prefire tests --help
prefire playbook --help
