Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
An Xcode extension (plugin) to generate Swift test doubles automatically.
| Date | Stars |
|---|---|
| 2026-07-24 | 757 |
| 2026-07-25 | 757 |
| 2026-07-28 | 757 |
| 2026-07-30 | 757 |
| 2026-08-06 | 757 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
> ⚠️ This plugin is no longer being actively worked on as the author is no longer writing much Swift. I will try to keep the app working but won't be adding new features. Thank you everyone for your support!
> ❗️ Your app may stop working after 10th September 2022 as the signing certificate will expire. [Download](https://github.com/seanhenry/SwiftMockGeneratorForXcode/releases) and install the most recent version to fix this issue.
# Swift Mock Generator Xcode Source Editor Extension

An Xcode extension (plugin) and command line tool to generate [spy](#what-is-a-spy), [stub](#what-is-a-stub), [dummy](#what-is-a-dummy), and [partial spy](#what-is-a-partial-spy) classes automatically.

[Looking for the AppCode version?](https://github.com/seanhenry/MockGenerator)
## Install Swift Mock Generator Xcode Source Editor Extension
- Close Xcode if it is open
- Download the latest release [here](https://github.com/seanhenry/SwiftMockGeneratorForXcode/releases)
- Copy the app to the `Applications` folder.
- Open the app
- Select OK for '"Swift Mock Generator for Xcode" wants access to control "Xcode"'
- Go to `System Preferences -> Extensions -> Xcode Source Editor` and make sure `Mock Generator` is enabled.
- Go to `System Preferences -> Security & Privacy -> Privacy -> Automation` and make sure `Swift Mock Generator` is enabled.
- Open Xcode
## Sandboxing
This extension is fully sandboxed which means you need to give permission to read your project files before using it.
### Give permission when automatically detecting the project path
- Open the companion app.
- Press "Give permission to read directory".
- Select the directory and press "Grant permission".
- In Xcode, generate your test double.
### Give permission when manually choosing the project path
- Open the companion app.
- Press the select directory button.
- Select the directory and press "Open".
- In Xcode, generate your test double.
**Please note if using manual project paths before v0.25 you will have to select your project path again.**
## How to create a new Swift test double
- Create an empty class inheriting from a class or protocols that you wish to mock.
Example:
```
class MyProtocolSpy: MyProtocol {
}
```
- Place the cursor inside the class declaration.
- Click `Editor -> Mock Generator -> Generate spy`.
## How to recreate a Swift mock
There's no need to delete the old code. Simply place the cursor anywhere inside the class declaration and generate the test double as before.
## Recommended: assign a shortcut
- Select preferences `⌘,` in Xcode.
- Choose 'Key Bindings'.
- Search for 'Mock Generator'.
- Choose your preferred shortcut.
## Recommended: use a version control system
The mock generator will replace anything that is currently in your class with the generated test double.
Undo is supported for Xcode plugins but you're safer to use a version control system such as `git` in the event of unexpectedly generating a test double.
## Using the command line tool
For convenience, create a symbolic link to the CLI.
```
$ ln -s "/Applications/Swift Mock Generator for Xcode.app/Contents/MacOS/genmock" /usr/local/bin/genmock
```
Use `$ genmock --help` for a list of options.
See how this project generates its mocks [here](https://github.com/seanhenry/SwiftMockGeneratorForXcode/blob/master/genmocks.sh).
## Features
| Feature | Supported |
|---|---|
| Swift 5.0|✅|
| Swift 5.1+||
| Generate a spy.|✅|
| Generate a stub.|✅|
| Generate a dummy.|✅|
| Generate a partial spy.|✅|
| **Classes and protocols** |
| Generates test doubles conforming to one or many protocols.|✅|
| Generates test doubles conforming to a class.|✅\*|
| Generates test doubles conforming to both classes and protocols.|✅\*|
| **Recording methods, properties and subscripts ** |
| Captures invocation status of methods.|✅|
| Captures invocation status of properties.|✅|
| Captures invocExcerpt of 11,033 characters
Read on GitHub15
1
Would you bet a product on this? Bounded 0–100 and slow moving.
matched fp:24cefa2d6690038b, topic:testing