Sourcery Pro is a Mac App that extends Xcode with the ability to create your own live templates that understand your code structure.

You can create any template you want but the app also comes bundled with many popular templates to get you started.

Download on the Mac App Store

Default templates include:

  • Mocks from any protocol
  • Codable conformance for enums with associated values
  • SwiftUI from data structure
  • Lenses / Prisms
  • Automatic interfaces from types
  • Type erasure
  • And many more…

More info

  1. Xcode integration
  2. Editor
  3. Writing templates

Xcode integration

The app provides an Xcode Source extensions that let’s you run templates you have against the code of your projects, see it in action:


Sourcery Pro standalone app features an editor:

  • Comes bundled with over 10 templates to get you started
  • Even though Stencil doesn’t haves types, Sourcery Pro gives you ability to add type attribution to your templates
  • Powerful code completion and inline documentation to make writing your own templates simpler.
  • Inline errors and warnings
  • Over 20 different color themes to choose from
  • Drag & Drop and import / export your templates to share with community or team members (Cloud sharing coming soon)
  • Bind key shortcuts to Sourcery Pro templates right in Xcode

Writing templates

Sourcery Pro adds additional functionality on top of regular stencil:

  • {% typed variable as MyType %} lets you add type information to macros, simply declare it after defining your macro and Sourcery Pro will start providing you with all type information for your variable
  • {% newline %} ends whitespace trimming in the template and adds an extra empty line


  1. Sourcery Pro extension doesn’t appear in my editor, what to do?
  2. My templates don’t appear in Xcode?
    • When you add/remove templates you need to restart Xcode, it’s the limitation of Xcode Source Extension. Also make sure that you marked Templates as available in Xcode (default), you can right click on template in the list to see other options
  3. How do I share templates?
    • Right click on the template list to see context menu
    • Or just drag & drop from / to it