diff --git a/Sources/CodableWrapperMacros/ModelMemberPropertyContainer.swift b/Sources/CodableWrapperMacros/ModelMemberPropertyContainer.swift index 09fff55..7fa30cd 100644 --- a/Sources/CodableWrapperMacros/ModelMemberPropertyContainer.swift +++ b/Sources/CodableWrapperMacros/ModelMemberPropertyContainer.swift @@ -75,7 +75,7 @@ struct ModelMemberPropertyContainer { var text = """ let \(transformerVar) = \(transformerExpr) - let \(tempJsonVar) = try? container.decode(type: type(of: \(transformerVar)).JSON.self, keys: [\(member.codingKeys.joined(separator: ", "))], nestedKeys: [\(member.nestedKeys.joined(separator: ", "))]) + let \(tempJsonVar) = try? container.decode(type: Swift.type(of: \(transformerVar)).JSON.self, keys: [\(member.codingKeys.joined(separator: ", "))], nestedKeys: [\(member.nestedKeys.joined(separator: ", "))]) """ if let initializerExpr = member.initializerExpr { @@ -90,7 +90,7 @@ struct ModelMemberPropertyContainer { return text } else { - let body = "container.decode(type: type(of: self.\(member.name)), keys: [\(member.codingKeys.joined(separator: ", "))], nestedKeys: [\(member.nestedKeys.joined(separator: ", "))])" + let body = "container.decode(type: Swift.type(of: self.\(member.name)), keys: [\(member.codingKeys.joined(separator: ", "))], nestedKeys: [\(member.nestedKeys.joined(separator: ", "))])" if let initializerExpr = member.initializerExpr { return "self.\(member.name) = (try? \(body)) ?? (\(initializerExpr))" diff --git a/Tests/CodableWrapperTests/TransformTest.swift b/Tests/CodableWrapperTests/TransformTest.swift index ab26828..90f88fd 100644 --- a/Tests/CodableWrapperTests/TransformTest.swift +++ b/Tests/CodableWrapperTests/TransformTest.swift @@ -72,7 +72,7 @@ struct DateModel_produce: Codable { init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: AnyCodingKey.self) - let time = try container.decode(type: type(of: DateWrapper.transformer).JSON.self, keys: ["time"], nestedKeys: []) + let time = try container.decode(type: Swift.type(of: DateWrapper.transformer).JSON.self, keys: ["time"], nestedKeys: []) self.time = DateWrapper.transformer.transformFromJSON(time) }