Last active
January 31, 2019 19:06
-
-
Save kylebshr/a34c3d0a2ca42282d4bec536ee00d6b1 to your computer and use it in GitHub Desktop.
(Weird?) behavior with Codable and properties
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Decoding a `Bar` gives you the same UUID that it was encoded with | |
struct Bar: Codable { | |
let id: UUID | |
init() { | |
self.id = UUID() | |
} | |
} | |
// Decoding a `Foo` gives you a new UUID | |
struct Foo: Codable { | |
let id = UUID() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment