Last active
December 1, 2018 20:12
-
-
Save regularberry/d446c087066bf1a90ec869c09b3989b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% macro methodSig method %} | |
func {{ method.name }} | |
{% if method.returnTypeName|!contains:"Void" %} -> {{method.returnTypeName}}{% endif %} | |
{% endmacro %} | |
{% for type in types.protocols %} | |
// sourcery:file:Mock{{ type.name }}.swift | |
import Foundation | |
class Mock{{ type.name }}: {{ type.name }} { | |
{% for method in type.allMethods %} | |
{% call methodSig method %}{ | |
} | |
{% endfor %} | |
} | |
// sourcery:end | |
{% endfor %} | |
{% for type in types.protocols %} | |
// sourcery:file:{{ type.name}}.swift | |
import Foundation | |
protocol {{ type.name }} { | |
{% for method in type.allMethods %} | |
{% call methodSig method %} | |
{% endfor %} | |
} | |
struct Default{{ type.name }}: {{ type.name }} { | |
{% for method in type.allMethods %} | |
{% call methodSig method %}{ | |
} | |
{% endfor %} | |
} | |
// sourcery:end | |
{% endfor %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment