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 Projector 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.
Prefireas a package dependency to your project without linking any of the products.Build Phasesinspector. OpenRun Build Tool Plug-insand select the+button. From the list, selectPrefirePlaybookPluginorPrefireTestsPlugin, 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.swiftmanifest.Package.swiftfile.pluginsparameter.Usage
For generate tests and playbook, simply mark your preview using protocol -
PrefireProvider:Playbook (Demo) View
To use Playbook, simply use
PlaybookViewisComponent: trueisComponent: falseSnapshot 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,OTPViewandPincodeViewIf a preview contains more than one
View, you can markStatefor these views.Config
You can additionaly configure Prefire by adding a
.prefire.ymlfile 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 DEBUGfor yours SwiftUI Previews. Xcode automatically removed Preview code, when you build release version.