Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/nikstar/broadcastcenter
- Owner: nikstar
- Created: 2024-08-26T14:00:58.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-26T20:10:06.000Z (5 months ago)
- Last Synced: 2024-08-26T23:19:06.415Z (5 months ago)
- Language: Swift
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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
}
```