Quickstart Guide
This guide will walk you through freezing your first SwiftData schema with FreezeRay.Prerequisites
- Xcode 15.0+
- Swift 5.9+
- iOS 17+ or macOS 14+ project with SwiftData
- Git repository (for tracking fixtures)
- npm (for CLI installation)
- Apple Silicon Mac (Intel users must build from source)
Install CLI
Install the FreezeRay CLI via npm:The CLI automatically adds the FreezeRay Swift package to your project when you run
freezeray init.Initialize Your Project
Navigate to your Xcode project directory and run:- Add FreezeRay package dependency to your
Package.swift - Create the
FreezeRay/directory structure - Set up
.gitignorerules (if needed)
Annotate Your Schema
Add@FreezeSchema to your schema definition:
Freeze Your Schema
Run the freeze command:- Build your project
- Run tests in iOS Simulator
- Extract schema fixtures to
FreezeRay/Fixtures/1.0.0/ - Generate validation tests in
FreezeRay/Tests/
Verify the Freeze
Check that fixtures were created:App-1_0_0.sqlite- SQLite database with schemaschema-1_0_0.json- JSON representationexport_metadata.txt- Metadata about the freeze
Commit the Fixtures
Commit the generated files to your repository:Run Tests
The generated tests run automatically with your test suite:- Verify the schema hasn’t drifted from the frozen version
- Validate that all models match the fixtures
Next Steps
Learn Core Concepts
Understand how FreezeRay works under the hood
Test Migrations
Learn how to test schema migrations between versions
CI Integration
Set up FreezeRay in your CI pipeline
CLI Reference
Explore all CLI commands and options