I wanted to share a tool I’ve been working on and already using in my own projects: SwiftMockGenerator.
The idea is simple: you annotate your protocol, class, or struct with // @Mock, and the tool automatically generates a ready-to-use mock for your tests.
It works both as a CLI. Supports async/await, throws methods, call tracking, and customizable stubs. It also ships with Homebrew support for quick installation:
brew tap manucodin/swift-mock-generator
brew install swift-mock-generator
My goal is to reduce the time spent writing test doubles and make tests more expressive—without adding heavy dependencies or complex DSLs.
Any feedback, issues, or improvement ideas are more than welcome.
If it helps anyone speed up their testing workflow, that already makes it worth it.
Thanks for the information! I'll take a look but it's a different approach. This solution does not generate any compile-time dependencies since it is a standalone CLI that relies on code comments.
But again, thank you very much for the information; I promise to take a look. All information is useful for future versions.