Skip to content

Instantly share code, notes, and snippets.

@el-hoshino
Created September 17, 2024 04:52
Show Gist options
  • Save el-hoshino/bfbab6077c456bdd817a4ef913fc3331 to your computer and use it in GitHub Desktop.
Save el-hoshino/bfbab6077c456bdd817a4ef913fc3331 to your computer and use it in GitHub Desktop.
Abstraction using struct
struct SomeComponent {
private var _doSomething: () -> Void
init(_doSomething: @escaping () -> Void) {
self._doSomething = _doSomething
}
func doSomething() {
_doSomething()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment