@@ -48,9 +48,9 @@ public struct ObservableMacro {
4848 return
4949 """
5050 internal nonisolated func access<Member>(
51- keyPath: KeyPath< \( observableType) , Member>
51+ keyPath: KeyPath< \( observableType) , Member>
5252 ) {
53- \( raw: registrarVariableName) .access(self, keyPath: keyPath)
53+ \( raw: registrarVariableName) .access(self, keyPath: keyPath)
5454 }
5555 """
5656 }
@@ -59,10 +59,10 @@ public struct ObservableMacro {
5959 return
6060 """
6161 internal nonisolated func withMutation<Member, MutationResult>(
62- keyPath: KeyPath< \( observableType) , Member>,
63- _ mutation: () throws -> MutationResult
62+ keyPath: KeyPath< \( observableType) , Member>,
63+ _ mutation: () throws -> MutationResult
6464 ) rethrows -> MutationResult {
65- try \( raw: registrarVariableName) .withMutation(of: self, keyPath: keyPath, mutation)
65+ try \( raw: registrarVariableName) .withMutation(of: self, keyPath: keyPath, mutation)
6666 }
6767 """
6868 }
@@ -202,7 +202,7 @@ extension ObservableMacro: MemberMacro {
202202 return [ ]
203203 }
204204
205- let observableType = identified. name
205+ let observableType = identified. name. trimmed
206206
207207 if declaration. isEnum {
208208 // enumerations cannot store properties
@@ -294,7 +294,7 @@ public struct ObservationTrackedMacro: AccessorMacro {
294294 ) throws -> [ AccessorDeclSyntax ] {
295295 guard let property = declaration. as ( VariableDeclSyntax . self) ,
296296 property. isValidForObservation,
297- let identifier = property. identifier else {
297+ let identifier = property. identifier? . trimmed else {
298298 return [ ]
299299 }
300300
@@ -306,24 +306,24 @@ public struct ObservationTrackedMacro: AccessorMacro {
306306 """
307307 @storageRestrictions(initializes: _ \( identifier) )
308308 init(initialValue) {
309- _ \( identifier) = initialValue
309+ _ \( identifier) = initialValue
310310 }
311311 """
312312
313313 let getAccessor : AccessorDeclSyntax =
314314 """
315315 get {
316- access(keyPath: \\ . \( identifier) )
317- return _ \( identifier)
316+ access(keyPath: \\ . \( identifier) )
317+ return _ \( identifier)
318318 }
319319 """
320320
321321 let setAccessor : AccessorDeclSyntax =
322322 """
323323 set {
324- withMutation(keyPath: \\ . \( identifier) ) {
325- _ \( identifier) = newValue
326- }
324+ withMutation(keyPath: \\ . \( identifier) ) {
325+ _ \( identifier) = newValue
326+ }
327327 }
328328 """
329329
0 commit comments