# Can swift macro create separate implementation of a declaration?

**URL:** <https://forums.swift.org/t/can-swift-macro-create-separate-implementation-of-a-declaration/65397>\
**Category:** Discussion\
**Tags:** macros\
**Created:** [June 7, 2023, 9:30am UTC](https://forums.swift.org/t/can-swift-macro-create-separate-implementation-of-a-declaration/65397 "2023-06-07T09:30:25Z")\
**Posts on this page:** 1\
**Showing post:** 21

<div class="post-metadata">

**Author:** ![Matejkob](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/matejkob/32/34399_2.png) [@Matejkob](https://forums.swift.org/u/Matejkob)\
**Post date:** [June 20, 2023, 3:07pm UTC](https://forums.swift.org/t/can-swift-macro-create-separate-implementation-of-a-declaration/65397/21 "2023-06-20T15:07:53Z")

</div>

> [@Frugoman](#):
>
> For my case at least (and perhaps OP's as well from the examples presented?), I was looking to create something like a Mocking library, that you can use for testing instead of having to create mocks manually and/or rely on a code generation tool for this.

Eventually, I've managed to create something like that. If you haven't seen it yet, you can find it here: [Introducing Spyable: A Swift Macro for Automatic Spies Generation - #8 by Matejkob](https://forums.swift.org/t/introducing-spyable-a-swift-macro-for-automatic-spies-generation/65572/8). In the current version, I've covered all cases that AutoMockable from Sorcery covers, but as you mentioned, there are a lot of edge cases. I would be very glad if you could contribute to this project. It would be awesome if you could add issues to the repo outlining the cases that you encounter during your own testing of this approach. Additionally, if you have any cool functionality in mind that you think could enhance the project, feel free to make a PR! ❤

---

_[View the full topic](https://forums.swift.org/t/can-swift-macro-create-separate-implementation-of-a-declaration/65397)._
