Skip to content

Releases

v1.0.0

Choose a tag to compare

@github-actions github-actions released this 02 Dec 22:15

Initial release of VersionedModels, a zero-dependency Swift 6 library for migrating models across schema versions in memory and decoding older persisted Codable payloads forward to your current model type.

Highlights

  • Format-agnostic migration core: ModelVersion and Versionable link each model type to its immediate predecessor at compile time with single-pass forward migration (migrate(from:), migrated(to:), canMigrate(from:), canMigrate(fromVersion:), canMigrate(to:)) and no Codable requirement.
  • Additive Codable persistence and pluggable wire shapes: DecodableVersionable, CodableVersionable, VersionedPayload, and VersionedPayloadFormat validate the stored raw UInt version before reading the model payload. Ships with built-in VersionedEnvelope ({"version": 1, "model": {...}}), FlattenedVersionedPayload, and UnkeyedVersionedPayload, plus KeyedVersionedPayloadFormat, FlattenedVersionedPayloadFormat, VersionedModelDecoder, and KeyedDecodingContainer / KeyedEncodingContainer versioned helpers.
  • Chain validation and clear errors: validateMigrationChain(scope:) (.allVersions, .upToCurrentVersion, .from(_:), .range(from:through:), .excluding(_:)) and reachableVersions() throw typed VersionMigrationError<Version>, and validateVersion(rawValue:) throws typed VersionedPayloadDecodingError.
  • Platform support: Pure Swift standard library (no Foundation or external dependencies) targeting Swift 6.4+ on iOS 16.0+, macOS 13.0+, tvOS 16.0+, visionOS 1.0+, and watchOS 9.0+.