PureYAML/docs/rules-swift/exp/migration.md
Mihaela M 5f3892f2c1 chore(rules): vendor the rules-swift canon into docs/rules-swift
Mirror the shared Swift rules canon (rules-swift, commit 4ebb892) into
docs/rules-swift/ as a read-only reference alongside the repo's tailored
docs/rules/. PROVENANCE.md records the source, commit, and what was
included or excluded; the upstream repo's own VCS, CI, and lint tooling
is omitted as machinery rather than rule content.

Exclude the vendored tree from the style gate (scripts/check-style.sh)
and the pre-commit hook: the canon's enforcement docs quote the
forbidden attribution phrases to define them, the same reason the
repo's own enforcement files are already excluded.
2026-06-26 05:36:12 +02:00

44 lines
779 B
Markdown

# Migration Patterns
Extracting code into a new package; splitting a large package.
### Extracting Code to New Package
```bash
# 1. Create new package structure
mkdir -p Packages/Sources/NewPackage
mkdir -p Packages/Tests/NewPackageTests
# 2. Move files
git mv OldPackage/SomeFeature.swift NewPackage/
# 3. Update Package.swift
# Add new target and product
# 4. Update imports in dependent files
# Change: import OldPackage
# To: import NewPackage
# 5. Rebuild
cd Packages && swift build
# 6. Run tests
swift test --filter NewPackageTests
```
### Splitting Large Package
```swift
// Before: Large "Features" package
Features/
├── Auth/
├── Profile/
└── Settings/
// After: Separate feature packages
AuthFeature/
ProfileFeature/
SettingsFeature/
```