Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nikstar/broadcastcenter

Type-safe alternative to NotificationCenter using async sequences
https://github.com/nikstar/broadcastcenter

Last synced: about 1 month ago
JSON representation

Type-safe alternative to NotificationCenter using async sequences

Awesome Lists containing this project

README

        

# BroadcastCenter

Type-safe version of NotificationCenter

Use this to broadcast values of different types

```swift
// Post a value
BroadcastCenter.shared.post(Foo(bar: 42))

// Elsewhere read values using async sequence:
for await foo in BroadcastCenter.shared.values(ofType: Foo.self) {
print(foo.bar) // 42
}
```