A type-safe NotificationCenter wrapper for Swift, supporting Swift Concurrency, Combine, and manual observation.
NoticeObserveKit is a Swift library that wraps Apple's NotificationCenter with type safety. It allows developers to define notifications with associated strongly-typed values, eliminating the need for manual type casting and dictionary parsing when posting or observing notifications. This reduces runtime errors and improves code clarity in iOS, macOS, tvOS, and watchOS applications.
Swift developers building applications for Apple platforms (iOS, macOS, tvOS, watchOS) who use NotificationCenter and want to improve type safety and maintainability in their notification handling code.
Developers choose NoticeObserveKit because it provides a seamless, type-safe alternative to NotificationCenter's raw dictionary-based API. It supports modern Swift paradigms like Concurrency and Combine, reduces boilerplate, and prevents common runtime errors associated with notification handling.
NoticeObserveKit is type-safe NotificationCenter wrapper.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses generic Notice.Name<T> to associate notifications with strongly-typed values, eliminating manual dictionary parsing and reducing runtime errors, as shown with UIKeyboardInfo in the README examples.
Provides async/await APIs for observing notifications as async sequences, making it easy to integrate with modern Swift concurrency patterns, available from iOS 15+ as demonstrated in the Task example.
Offers a Publisher for seamless use with Apple's Combine framework, enabling reactive observation of notifications with type safety, as seen in the .publisher(for:) snippet.
Includes ObserverPool to automatically invalidate observers and prevent memory leaks without manual cleanup, referenced in the original observation API with .invalidated(by: pool).
When using existing NotificationCenter notifications like UIResponder.keyboardWillShowNotification, you must implement custom decode logic to map userInfo dictionaries to typed values, adding boilerplate as shown in the usage example.
Full feature support, especially for Swift Concurrency, requires iOS 15+ or equivalent platforms, limiting its use in projects targeting older versions without workarounds.
Introduces a third-party library for functionality that Apple's NotificationCenter provides natively, which can increase project complexity and maintenance burden compared to raw APIs.