Skip to content

Instantly share code, notes, and snippets.

@charlesmuchene
Created February 21, 2020 06:07
Show Gist options
  • Select an option

  • Save charlesmuchene/e780159ff9709d2aaee31db92ea24f79 to your computer and use it in GitHub Desktop.

Select an option

Save charlesmuchene/e780159ff9709d2aaee31db92ea24f79 to your computer and use it in GitHub Desktop.
Single method invocable usecase
@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