Releases: jrothwell/VersionedCodable
v1.1.1
What's Changed
- Harmonises
NothingEarlier
's encoding behaviour with howNever
behaves if you attempt to encode it, in #13- This matches the behaviour of
Never
's conformance toCodable
, new in Swift 5.9. It also means our last reason for makingNever
conform toVersionedCodable
is gone (see #12)
- This matches the behaviour of
- Improves documentation.
Full Changelog: v1.1.0...v1.1.1
v1.1.0
What's New
- Adds support for different paths to the version field. You achieve this by creating a
Codable
type that adoptsVersionPathSpec
, and specifying this on yourVersionedCodable
type.- The default behaviour is unchanged and is available as
VersionKeyAtRootVersionPathSpec
. This is automatically chosen for you if you do not specify aVersionSpec
in yourVersionedCodable
.
- The default behaviour is unchanged and is available as
- Removes support for throwing
VersionedEncodingError.typeHasClashingVersionField
encode time if the type has aversion
key. This was an expensive operation which wouldn't work anyway with different key paths to the version field. In an ideal world it would be possible to test this at compile time, but I don't currently see how this is possible without a compiler plugin. - Improves documentation. Documentation is now deployed with links to the source code.
Full Changelog: 1.0.2...v1.1.0
1.1.0 Beta 1
- Adds support for different paths to the version field. You achieve this by creating a
Codable
type that adoptsVersionPathSpec
. - Removes support for throwing an error at encode time if the type has a
version
key. This was an expensive operation which wouldn't work anyway with different key paths to the version field - or at least not yet.
2.0.0 Beta 2
Adds support for Swift Macros to VersionedCodable
. You can now declare conformance to VersionedCodable
like this:
@versionedCodable(v: 2, previously: PoemV1)
struct PoemV2 {
var authorName: String?
var authorDateOfBirth: Date?
var authorDateOfDeath: Date?
var poem: String
init(from old: PreviousVersion) throws {
self.authorName = old.author
self.poem = old.poem
}
}
Because macros are a new feature in the compiler, VersionedCodable
2.0 will require Swift 5.9.
This supersedes v2.0.0-beta.1, fixing a bug where nested types declared as PreviousVersion
using the macro would only have their first token carried through to the resulting expansion (e.g. PreviousVersions.Version1
would be carried through as PreviousVersion
, causing a compile error.) This was fixed by sending through the whole expression rather than just the first token.
As a side effect, the macro now does not use the usage of .self
at the end of the previously
parameter. This does look very weird, so a future enhancement would be to have compiler diagnostics help people stop doing this.
v1.0.2
Adds a privacy manifest file. This fulfils Apple's upcoming requirements for third party SDKs to provide a privacy manifest file, which will be combined with an adopting app's privacy manifest file to create the app's privacy nutrition label.
For the avoidance of doubt, VersionedCodable
does not, and will never, collect any user-identifying information, nor does it ever send anything off the device.
What's Changed
- Adds a privacy manifest file #7
Full Changelog: 1.0.1...1.0.2
v1.0.1
A performance improvement and some documentation fixes.
What's Changed
- Fix #2: Only decode the version number once in #3. This should result in performance improvements.
- Add one performance test.
- Fix some slight problems with the documentation examples not quite matching up.
- Fix some incorrect failure messages in the tests which refer to the old name of an error which has since been renamed.
Full Changelog: 1.0.0...1.0.1
v1.0.0
Version 1.0.0.
- The API can now be considered stable.
- Documentation has been considerably improved.
Full Changelog: 0.5.2...1.0.0
Please raise an issue if you have a feature request or found a bug, or write to the email address in @jrothwell's profile. Thanks for your interest!
0.5.2
- Marks
encodeTransparently
aspublic
when it was previously internal.
Full Changelog: 0.5.1...0.5.2
v0.5.1
Adds a way of adding support for VersionedCodable
to non-Foundation
encoders and decoders.
Full Changelog: 0.5.0...0.5.1
v0.5.0
Adds a new error that's thrown when you try to encode a type with version
on it.
Also improves documentation such that extended symbols now appear.
Full Changelog: 0.4.2...0.5.0