From 7f0faf215cb0a3785afdc52c21fb52f6f7db0f3f Mon Sep 17 00:00:00 2001 From: bengHak Date: Thu, 15 Jun 2023 08:56:44 +0900 Subject: [PATCH 1/2] Add trimming to an identifier --- MacroExamplesPlugin/ObservableMacro.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MacroExamplesPlugin/ObservableMacro.swift b/MacroExamplesPlugin/ObservableMacro.swift index 16ee346..74ccfaa 100644 --- a/MacroExamplesPlugin/ObservableMacro.swift +++ b/MacroExamplesPlugin/ObservableMacro.swift @@ -28,7 +28,7 @@ public struct ObservableMacro: MemberMacro, MemberAttributeMacro { return [] } - let parentName = identified.identifier + let parentName = identified.identifier.trimmed let registrar: DeclSyntax = """ From 6b01ad08fd3b1fa4ab4b6a685c6bfdeeb4b8477b Mon Sep 17 00:00:00 2001 From: bengHak Date: Thu, 15 Jun 2023 08:59:12 +0900 Subject: [PATCH 2/2] Adjust indentation --- MacroExamplesPlugin/CustomCodable.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/MacroExamplesPlugin/CustomCodable.swift b/MacroExamplesPlugin/CustomCodable.swift index d45976d..c9fdc05 100644 --- a/MacroExamplesPlugin/CustomCodable.swift +++ b/MacroExamplesPlugin/CustomCodable.swift @@ -34,8 +34,7 @@ public struct CustomCodable: MemberMacro { let codingKeys: DeclSyntax = """ - enum CodingKeys: String, CodingKey { - \(raw: cases.joined(separator: "\n")) + enum CodingKeys: String, CodingKey {\n\(raw: cases.joined(separator: "\n")) } """