Always build for the iOS Simulator. This package depends on UIKit, so bare
swift buildwill fail on macOS. Usexcodebuildwith a simulator destination for all build and test commands.
# Build package (iOS Simulator)
xcodebuild build -scheme GentleDesignSystem -destination 'platform=iOS Simulator,name=iPhone 16' -quiet
# Clean build
xcodebuild clean build -scheme GentleDesignSystem -destination 'platform=iOS Simulator,name=iPhone 16' -quiet# Run all tests
swift test
# Run specific test
swift test --filter GentleDesignSystemTests
# Run snapshot tests only
swift test --filter SnapshotTestsSnapshot tests verify that token values and UI rendering remain consistent. They use swift-snapshot-testing with HEIC image support.
Snapshot types:
- JSON snapshots - Verify preset spec serialization (
.txtfiles) - Image snapshots - Verify UI rendering in light/dark mode (
.heicfiles)
Recording new snapshots:
Snapshots are configured with .snapshots(record: .missing), so new tests automatically record baselines on first run. To re-record all snapshots:
# Delete existing snapshots and re-run tests
rm -rf Tests/GentleDesignSystemTests/__Snapshots__
swift test --filter SnapshotTestsWhen to update snapshots:
- After intentionally changing default token values
- After adding new presets
- After modifying view modifiers that affect rendering
Snapshot location: Tests/GentleDesignSystemTests/__Snapshots__/SnapshotTests/
cd Demo
# Install Ruby dependencies (first time)
bundle install
# Build demo app (simulator)
bundle exec fastlane ios buildcd Demo
xcodebuild -project GentleDesignSystemDemo.xcodeproj \
-scheme GentleDesignSystemDemo \
-destination 'platform=iOS Simulator,name=iPhone 16' \
buildLocation: .github/workflows/ci.yml
Trigger: Push to main or any PR
Runner: macos-26 (Xcode 26)
Steps:
- Checkout
- Setup Ruby 3.3 with Bundler
- Install xcresultparser (for coverage conversion)
- Build demo app (
bundle exec fastlane ios build) - Run package tests (
bundle exec fastlane ios package_tests) - Convert coverage to XML (
bundle exec fastlane coverage_xml) - Upload coverage to Codecov
# Package
open Package.swift
# Demo app
open Demo/GentleDesignSystemDemo.xcodeprojDemo app has previews in ThemeStudioView.swift:
- Light mode preview
- Dark mode preview
- Build and run demo app
- Tap gear icon for settings
- Edit tokens live
- Tap "Update and Save" to persist
To inspect the current theme spec as JSON, use the share/export feature in GentleDesignStudioView, or call spec.encodedJSONString() programmatically:
let jsonString = try themeManager.theme.spec.encodedJSONString()
print(jsonString)- Update
GentleDesignSystemSpecVersion.currentif schema changed - Update README.md if needed
- Create PR to main
- CI must pass
- Merge and tag (e.g.,
0.1.0)
Demo app needs the package. Xcode should resolve automatically. If not:
cd Demo
xcodebuild -resolvePackageDependenciescd Demo
bundle update
bundle exec fastlane ios buildCheck runner has Xcode 26 (macos-26). Verify scheme name matches.