File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
docs/architecture/mobile-clients/ios Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -468,3 +468,27 @@ or it cannot handle some closure types, specially in function's parameters. In s
468468create the mock manually and remove the protocol's comment as ` AutoMockable ` .
469469
470470:::
471+
472+ #### Custom annotations
473+
474+ Sourcery allows us to annotate different parts of our code to guide code generation. On top of this
475+ custom annotations have been added in ` AutoMockable.stencil ` to handle special cases.
476+
477+ - ** useSelectorName** : Method annotation used to indicate that the generated mocked properties need
478+ to use the selector name instead of the short method name. This is specially useful when using
479+ function overloading where we need the mocked names to also have the parameters names to
480+ differentiate between the different mocked functions.
481+ - ** mockReceivedInvocations** : Method annotation used to indicate that we want to generate the
482+ mocked property to store an array of the received invocations of the parameters passed each time
483+ the function is called.
484+
485+ For example:
486+
487+ ``` swift
488+ protocol FooProtocol { // sourcery: AutoMockable
489+ func bar (fooParameter : String ) -> Bool
490+ func bar (anotherParameter : Int ) -> Bool // sourcery: useSelectorName
491+ func saveNumber (theNumber : Int ) -> Bool // sourcery: mockReceivedInvocations
492+ func annotateMultiple (fooParameter : String ) // sourcery: useSelectorName, mockReceivedInvocations
493+ }
494+ ```
You can’t perform that action at this time.
0 commit comments