From 360c22620b7f2584958d6c5936874a1bf18b1e9c Mon Sep 17 00:00:00 2001 From: JARMourato Date: Thu, 24 Nov 2022 20:55:10 -0800 Subject: [PATCH] add default values to kodabletransformer init --- Sources/Kodable/KodableTransformable.swift | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Sources/Kodable/KodableTransformable.swift b/Sources/Kodable/KodableTransformable.swift index 3a1bd66..132054a 100644 --- a/Sources/Kodable/KodableTransformable.swift +++ b/Sources/Kodable/KodableTransformable.swift @@ -48,18 +48,18 @@ public protocol KodableTransform { set { try? setValue(newValue) } } - public init(key: String? = nil, options: [KodableOption], defaultValue: TargetType?) { - self.key = key - self.options = options - _value = defaultValue - } - // MARK: Public Initializers public init() { options = [] } + public init(key: String? = nil, options: [KodableOption] = [], defaultValue: TargetType? = nil) { + self.key = key + self.options = options + _value = defaultValue + } + // MARK: Codable Conformance /// All custom behavior is lost when the `Decodable` initializer is used