From d6096c7ee5fd7f9987588c583afec0c182ab7b91 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 7 Sep 2023 09:20:43 -0400 Subject: [PATCH 1/2] Change ID default initializer, DecodableDefault for implicit decoding models. Add missing id encodes and decodes. --- .../MVMCore/Utility/PropertyWrappers/DecodableDefault.swift | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift b/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift index b891942..13db64a 100644 --- a/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift +++ b/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift @@ -65,6 +65,10 @@ extension DecodableDefault { public enum EmptyMap: Source { public static var defaultValue: T { [:] } } + + public struct UUIDSource: DecodableDefaultSource { + public static var defaultValue: String { Foundation.UUID().uuidString } + } } } @@ -74,6 +78,7 @@ extension DecodableDefault { public typealias EmptyString = Wrapper public typealias EmptyList = Wrapper> public typealias EmptyMap = Wrapper> + public typealias UUID = Wrapper } extension DecodableDefault.Wrapper: Equatable where Value: Equatable {} From ba8f0b90ca74b24d421b9d9ebf6ad27a23345157 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 7 Sep 2023 12:46:04 -0400 Subject: [PATCH 2/2] DecodableDefault.UUID -> UUIDString --- .../MVMCore/Utility/PropertyWrappers/DecodableDefault.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift b/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift index 13db64a..9d1bb69 100644 --- a/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift +++ b/MVMCore/MVMCore/Utility/PropertyWrappers/DecodableDefault.swift @@ -66,8 +66,8 @@ extension DecodableDefault { public static var defaultValue: T { [:] } } - public struct UUIDSource: DecodableDefaultSource { - public static var defaultValue: String { Foundation.UUID().uuidString } + public struct UUIDStringSource: DecodableDefaultSource { + public static var defaultValue: String { UUID().uuidString } } } } @@ -78,7 +78,7 @@ extension DecodableDefault { public typealias EmptyString = Wrapper public typealias EmptyList = Wrapper> public typealias EmptyMap = Wrapper> - public typealias UUID = Wrapper + public typealias UUIDString = Wrapper } extension DecodableDefault.Wrapper: Equatable where Value: Equatable {}