Mimic

Mimic


Generate mocks, spies, stubs, and dummies for Swift in Xcode!

Mimic

Features:

One-Click Generation

Generate Spy, Partial Spy, Stub, or Dummy test doubles straight from the Xcode Editor menu.

Native Swift Output

No custom DSL — generated code is plain Swift, ready to drop into any architecture or test setup.

Generics & Closures

Full support for generic types, closure parameters, and multiple inheritance/conformance.

Invocation Tracking

Captures call counts and input parameters for methods, subscripts, getters, and setters.

Configurable Rendering

Companion app lets you manage project permissions and tweak generation settings.

Swift 5.0+ / Xcode 11+

Built and tested against modern Swift and Xcode toolchains, actively maintained.


Getting Started

1

Grant Xcode Extension Permissions

  • Launch the Mimic app and click Authorize.
  • Click Open Preferences and enable the Xcode Source Editor toggle for Mimic.
Clicking Authorize in the Mimic app Enabling the Xcode Source Editor toggle

These steps differ slightly depending on your macOS version. The Authorization screen in the Mimic app will show you the exact steps for your system.

2

Grant Derived Data Permissions

  • Click Permissions.
  • Click Link Derived Data, then click Grant Permissions on the dialog presented.
Clicking Link Derived Data Granting permissions on the Derived Data dialog

If you use a custom Derived Data location, navigate to that directory instead of the default.

3

Add Your Project(s)

  • Click Add Project on the Permissions screen.
  • Navigate to the root directory of your Xcode project or Swift package, and click Grant Permissions.
Clicking Add Project on the Permissions screen Granting permissions on a project's root directory

Mimic supports directories containing: `.xcodeproj`, `.xcworkspace`, and `Package.swift` files.

4

Using the Xcode Extension

  • Find or add a mock candidate, then select within the declaration — or within a nested method.
  • Click Editor → Mimic and select one of the Generate options.
Selecting within a mock candidate declaration Selecting a Generate option from the Editor > Mimic menu

Mimic uses IndexStore to resolve symbols — wait for your project to finish indexing before generating a mock.


  • If this is your first ever usage of Mimic you will need to allow access.
  • Your mock output should generate directly in the editor.
First use permissions Generated mock output in the Xcode editor

On first use, a permissions/access dialog will appear. Click Allow/Accept to continue.

Common Troubleshooting

Please reach out to CheekyGhost Labs if you have any explicit examples or suggestions for improvements in generation and code formatting 🙏

Editor action is greyed out

This usually means either Xcode hasn't finished loading extensions, or you need to add explicit permission in the system extension settings.

Derived Data and project permissions

error: "Permissions..."

The permissions setup has been hardened and will most likely last until you physically remove permissions. Occasionally, however, you may need to re-grant permissions in the Mimic app — usually after significant system or OS updates. The Xcode editor will show an error banner (and a notification, if granted) — resolve this by clicking the Re-link Project button in the app. As a fallback, remove and re-add the project permissions.

The same applies to the Derived Data permissions at the top of the Permissions tab in the app.

Symbol resolution

error: "Unable to resolve symbols..."

This usually means IndexStore hasn't finished processing the area you're trying to mock. A way to actively observe Xcode's indexing status is in development. If you hit this error, wait for indexing to finish — or, worst case, quit and restart Xcode.

Formatting

If you come across any weird formatting, it may indicate invalid Swift syntax (or a similar setup issue). Since most projects have their own formatting phase, if you're not a fan of Mimic's default format, we'd suggest running your own formatter as needed.


Changelog

2.1.0 — Current Version

  • [FEATURE] Redesigned the Settings screen with a cleaner, card-based layout
  • [BUG] Fixed Terms of Service and Privacy Policy links not opening from the subscription view
  • [BUG] Fixed toggle alignment in Settings so switches sit consistently at the trailing edge
2.0.1
  • [BUG] Fixed bug where invalid declarations would render. i.e private or let etc
  • [BUG] Fixed bug where subscripts with same indices but with different return types were being considered the same and only rendering the first found.
2.0.0
  • [FEATURE] Added Swift package project support
  • [FEATURE] Uses IndexStore to resolve symbols. Occasional gremlin but far more accurate.
  • [FEATURE] Uses SwiftSyntax library to generate code. Hardening source creation.
  • [FEATURE] Default values generated for tuples and closures where possible
  • [FEATURE] Generate test doubles inheriting from types within SPM dependencies
  • [FEATURE] Support for throwing closures
  • [FEATURE] Better support for structured concurrency
  • [FEATURE] Better support for operator declarations
  • [FEATURE] Better support for classes/subclasses with complex generics
  • [FEATURE] Support for pre and post generation content
  • [BUG] Support for inout properties
  • [BUG] Better support for protocols with inheritance
  • [BUG] Support for protocols with primary associated types
  • [BUG] Better support for functions and variables named the same across different protocols
  • [BUG] Hardened duplication naming support
1.0.4
  • [BUG] Fixed issue where some function partial spies were not generating super calls
  • [BUG] Fixed issue where sidebar unable to be re-opened
  • [UPDATE] Unable to resolve Package-based directory permissions 😞
1.0.3
  • [BUG] Ensure correct indentation/formatting when generating for nested type
  • [BUG] Don't re-generate initializers that having matching signatures across multiple inheritances 😅
  • [BUG] Fix random ordering of generated functions
  • [BUG]/[FEATURE] Better feedback for stale or corrupt project permissions
  • [BUG] Fix bug where Package.swift files in root directory cause permission errors
1.0.2
  • [BUG] Exclude optional symbol from stubbed subscript properties
  • [BUG] Default subscript generics with no type requirement to Any when expanding
  • [BUG] Honour optional outputs in subscripts
  • [BUG] Enforce standardised init order
1.0.1
  • Added support for Swift Playground project types
  • Fixed bug where duplicate keywords would appear on some initializers
  • Ensured redundant convenience init is not included in output when not required
  • Fixed bug parsing some attributes in function parameters
1.0.0

Initial release.

Trending Tags