Prefire can be install for an Xcode Project or only for one Package.
Xcode Project Plugin
You can integrate Prefire as an Xcode Build Tool Plug-in if you’re working
on a project in Xcode.
Add Prefire as a package dependency to your project without linking any of the products.
Select the target to which you want to add linting and open the Build Phases inspector.
Open Run Build Tool Plug-ins and select the + button.
From the list, select PrefirePlaybookPlugin or PrefireTestsPlugin, and add it to the project.
Swift Package Plugin
You can integrate Prefire as a Swift Package Manager Plug-in if you’re working with
a Swift Package with a Package.swift manifest.
Add Prefire as a package dependency to your Package.swift file.
A library for easily generating automatic Playbook (Demo) view and Tests using SwiftUI Preview
Works with: UI-components, screens and flows
Prefire
Do you like SwiftUI Preview and use it? Then you must try 🔥Prefire!
You can try 🔥Prefire starting from example project.
Installation
Prefire can be install for an
Xcode Project
or only for onePackage
.Xcode Project Plugin
You can integrate Prefire as an Xcode Build Tool Plug-in if you’re working on a project in Xcode.
Prefire
as a package dependency to your project without linking any of the products.Build Phases
inspector. OpenRun Build Tool Plug-ins
and select the+
button. From the list, selectPrefirePlaybookPlugin
orPrefireTestsPlugin
, and add it to the project.Swift Package Plugin
You can integrate Prefire as a Swift Package Manager Plug-in if you’re working with a Swift Package with a
Package.swift
manifest.Package.swift
file.plugins
parameter.Usage
For generate tests and playbook, simply mark your preview using protocol -
PrefireProvider
:Playbook (Demo) View
To use Playbook, simply use
PlaybookView
isComponent: true
isComponent: false
Snapshot tests
Just run generated tests 🚀
For detailed instruction you can see swift-snapshot-testing
API
New commands for previews:
Function for connecting preview together in one Flow:
For example Authorization flow:
LoginView
,OTPView
andPincodeView
If a preview contains more than one
View
, you can markState
for these views.Config
You can additionaly configure Prefire by adding a
.prefire.yml
file to root folder. For example:target
- Your project Target for Snapshot tests. Default: FirstTargettest_file_path
- Filepath to generated file. Default: DeriveDatasimulator_device
- Device for Snapshot testing. Default: iPhone 14 Prorequired_os
- iOS version for Snapshot testing. Default: iOS 16Requirements
Previews Troubleshooting
#IF DEBUG
for yours SwiftUI Previews. Xcode automatically removed Preview code, when you build release version.