Skip to content
This repository has been archived by the owner on Dec 27, 2021. It is now read-only.

Latest commit

 

History

History
32 lines (20 loc) · 675 Bytes

README.md

File metadata and controls

32 lines (20 loc) · 675 Bytes

HookKit

Generic event hook functions and invocation for Swift.

Install

Add the repository as a dependency:

.package(url: "https://github.com/binarybirds/hook-kit", from: "1.0.0"),

Add HookKit to the target dependencies:

.product(name: "HookKit", package: "hook-kit"),

Update the packages and you are ready to use HookKit.

Basic usage

let hooks = HookStorage()
hooks.register("test") { _ in "Hello world" }
let result: String? = hooks.invoke("test")
print(result) /// Optional("Hello world")

To learn more about hook functions, please read my article.