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

BinaryBirds/hook-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.