Created
February 21, 2020 06:07
-
-
Save charlesmuchene/e780159ff9709d2aaee31db92ea24f79 to your computer and use it in GitHub Desktop.
Single method invocable usecase
This file contains hidden or 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
| @dynamicCallable | |
| protocol UseCase { | |
| func invoke() | |
| } | |
| extension UseCase { | |
| func dynamicallyCall(withArguments: [Void]) { | |
| invoke() | |
| } | |
| } | |
| class UseCaseImpl: UseCase { | |
| func invoke() { | |
| debugPrint("Invalidate cache") | |
| } | |
| } | |
| let usecase = UseCaseImpl() | |
| usecase() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment