From fd009c94258e7f4ad687c3c82ba8ba59bcbfb4ca Mon Sep 17 00:00:00 2001 From: mikun <1211153686@qq.com> Date: Fri, 13 Nov 2020 12:03:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Xcode=2012=20=E7=BC=96=E8=AF=91=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/Attributes/AlterCodingKeys.swift | 7 +++++++ Source/Attributes/NonConformingFloatStrategy.swift | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/Attributes/AlterCodingKeys.swift b/Source/Attributes/AlterCodingKeys.swift index 00e48e5..a5db548 100644 --- a/Source/Attributes/AlterCodingKeys.swift +++ b/Source/Attributes/AlterCodingKeys.swift @@ -44,6 +44,13 @@ extension Happy { self.codingKeys = codingKeys } + public init(wrappedValue creater: @escaping @autoclosure () -> T) { + (T.self as? CodingKeysFilter.Type)?.precondition() + + self.constructor = creater + self.codingKeys = [] + } + public init(_ codingKeys: String...) where T == Wrapped? { (T.self as? CodingKeysFilter.Type)?.precondition() diff --git a/Source/Attributes/NonConformingFloatStrategy.swift b/Source/Attributes/NonConformingFloatStrategy.swift index 2d1584c..58ca562 100644 --- a/Source/Attributes/NonConformingFloatStrategy.swift +++ b/Source/Attributes/NonConformingFloatStrategy.swift @@ -27,7 +27,7 @@ extension Happy { storage = newValue } } - public init(wrappedValue constructor: @escaping @autoclosure () -> Float, decode: Foundation.JSONDecoder.NonConformingFloatDecodingStrategy, encode: Foundation.JSONEncoder.NonConformingFloatEncodingStrategy) { + public init(wrappedValue constructor: @escaping @autoclosure () -> Float, decode: Foundation.JSONDecoder.NonConformingFloatDecodingStrategy = .throw, encode: Foundation.JSONEncoder.NonConformingFloatEncodingStrategy = .throw) { self.constructor = constructor self.encodeStrategy = encode self.decodeStrategy = decode