Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
/ PugNotification Public archive

Strongly typed notifications for Swift. You might not need the pug parts.

License

Notifications You must be signed in to change notification settings

mrh-is/PugNotification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypedNotification: Strongly typed notifications in Swift

Notifications are a common communication mechanism on Apple platforms, but their API is stringly-typed and uses a Dictionary to carry extra information, both of which mean that failures are totally silent. That ain't Swifty!™

TypedNotification provides a wrapper around Foundation.NotificationCenter that lets the compiler help you out. It removes the magic strings, and provides a strongly typed way to send extra data.

TypedNotification is implemented as a protocol. Just make your enums conform, and BAM you're done.

This repo

This repo contains an Xcode playground demonstrating the use of TypedNotification. Launch the playground, and poke around the Sources folder. You're free to also use the pug-themed code.

This repo also contains the presentation I gave at SLUG (video forthcoming).

Suggestions?

Make a PR! I've already improved this code several times while writing the presentation, so there's surely more ways to make it better.

About

Strongly typed notifications for Swift. You might not need the pug parts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages