Latest 0.1.0
License MIT
Platforms osx 10.13
Dependencies Idioms, ShellInterface


Pure-Swift meta-programming

Proof-of-concept pure Swift code-generator that runs on top of Sourcery.


Sourcerer consists of a series of swift modules that you can import into your macOS application to load the information that Sourcery extracts from Swift sources, the SourceryRuntime.Types object.

  • SourcererArchiver uses Sourcery to write an archive of the SourceryRuntime.Types object to the disk.
  • SourcererUnarchiver unarchives the SourceryRuntime.Types object into the running application.
  • SourceryRuntime is required by the unarchiver to load the archive information.
  • SourcererTypes and SourcererRenderer contain some helpers and extensions to SourceryRuntime.Types.

To see how it works, take a look at the sample project:

$ git clone
$ cd swift-sourcerer
$ pod install
$ open sourcerer.xcworkspace


Steps to get started using Sourcerer in your own project:

  • Create a new macOS project (e.g. Example):

  • Set up dependencies (Podfile):
target 'Example' do
  # archive
  pod 'SourcererArchiver', :git => ''
  # unarchive
  pod 'SourcererUnarchiver', :git => ''
  pod 'SourceryRuntime', :git => ''
  • Download SourceryRuntime sources:


  • Implement initial code (main.swift):
import SourceryRuntime
import SourcererArchiver
import SourcererUnarchiver

let ignoreUnknownArguments = false
let archive = GenerateTypesArchive().execute
let unarchive = UnarchiveTypesFromPath().execute

let typesArchivePath = try archive(ignoreUnknownArguments)
let types = try unarchive(typesArchivePath)

print("- There are (types.protocols.count) protocols.")
print("- There are (types.structs.count) structs.")
print("- There are (types.classes.count) classes.")
  • When executing this example you need to pass: (1) the path to the Sourcery executable (--sourcery-path) and (2) the path to the sources (--sources):

Example --sourcery-path /path/to/sourcery --sources /path/to/sources/

Latest podspec

    "name": "SourcererArchiver",
    "version": "0.1.0",
    "summary": "Pure-Swift meta-programming (Archiver)",
    "description": "Proof-of-concept pure Swift code-generator that runs on top of [Sourcery](",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Hu00e8ctor Marquu00e8s": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.0"
    "platforms": {
        "osx": "10.13"
    "static_framework": true,
    "source_files": "Sources/SourcererArchiver/**/*",
    "dependencies": {
        "Idioms": [],
        "ShellInterface": []

Pin It on Pinterest

Share This