diff --git a/MacroAndCompilerPlugin/SpryableMacro/SpryableAccessorMacro.swift b/MacroAndCompilerPlugin/SpryableMacro/SpryableAccessorMacro.swift index 4aaa82c..2339332 100644 --- a/MacroAndCompilerPlugin/SpryableMacro/SpryableAccessorMacro.swift +++ b/MacroAndCompilerPlugin/SpryableMacro/SpryableAccessorMacro.swift @@ -36,7 +36,7 @@ public enum SpryableAccessorMacro: AccessorMacro { ) result.append( - .init(accessorSpecifier: .keyword(.set), body: .init(statements: "return spryify(\"\(raw: name)_set\")")) + .init(accessorSpecifier: .keyword(.set), body: .init(statements: "return spryify(\"\(raw: name)_set\", arguments: newValue)")) ) } else if let effectSpecifiers { result.append( diff --git a/Tests/Helpers/Spryable+TestHelper.swift b/Tests/Helpers/Spryable+TestHelper.swift index 2b92d70..d7ddcfd 100644 --- a/Tests/Helpers/Spryable+TestHelper.swift +++ b/Tests/Helpers/Spryable+TestHelper.swift @@ -7,8 +7,15 @@ final class SpryableTestClass: @unchecked Sendable { @SpryableFunc static func getAStaticString() -> String - @SpryableVar(.set, .get) - var firstName: String + /// @SpryableVar(.set, .get) + var firstName: String { + get { + return spryify("firstName_get") + } + set { + return spryify("firstName_set", arguments: newValue) + } + } @SpryableFunc func getAString(string: String) -> String diff --git a/Tests/SpryableMacrosTests.swift b/Tests/SpryableMacrosTests.swift index 8851020..7097de6 100644 --- a/Tests/SpryableMacrosTests.swift +++ b/Tests/SpryableMacrosTests.swift @@ -123,7 +123,7 @@ final class SpryableMacrosTests: XCTestCase { return spryify("barSet_get") } set { - return spryify("barSet_set") + return spryify("barSet_set", arguments: newValue) } } static static var barAsyncThrows: Int { @@ -226,7 +226,7 @@ final class SpryableMacrosTests: XCTestCase { return spryify("barSet_get") } set { - return spryify("barSet_set") + return spryify("barSet_set", arguments: newValue) } } public static var barThrows: Int { @@ -234,7 +234,7 @@ final class SpryableMacrosTests: XCTestCase { return spryify("barThrows_get") } set { - return spryify("barThrows_set") + return spryify("barThrows_set", arguments: newValue) } } var barAsyncThrows: Int { @@ -346,7 +346,7 @@ final class SpryableMacrosTests: XCTestCase { return spryify("barSet_get") } set { - return spryify("barSet_set") + return spryify("barSet_set", arguments: newValue) } } public static var barThrows: Int { @@ -354,7 +354,7 @@ final class SpryableMacrosTests: XCTestCase { return spryify("barThrows_get") } set { - return spryify("barThrows_set") + return spryify("barThrows_set", arguments: newValue) } } var barAsyncThrows: Int {