TypedNotification provides a set of protocols that define a stronger type system for notifications in Swift. The protocols help eliminate bugs arising from the stringly typed Foundation notification APIs and provide type safety and self-documentation for data attached to notifications. An additional lightweight class that automatically manages observer removal helps reduce run time errors.
TypedNotification can be installed using the Swift Package Manager or Carthage.
This repository contains a small demo playground (
explains how to use TypedNotification by example. There's also
a blog post which goes into some more detail on
the implementation of TypedNotification.