A micro-library for creating and observing events in Swift, replacing delegates, actions, and NotificationCenter.
Signals is a lightweight Swift library that provides a type-safe, elegant alternative to traditional event-handling patterns like delegates, actions, and NSNotificationCenter. It simplifies communication between components by enabling observable events with minimal boilerplate and strong compiler safety, reducing runtime errors and improving code maintainability.
iOS, watchOS, and macOS developers using Swift who need a modern, type-safe solution for event handling and inter-component communication, particularly those looking to replace delegates, actions, or NotificationCenter in their apps.
Developers choose Signals for its attach-and-forget observation that automatically cancels subscriptions when observers deallocate, strong type safety that reduces runtime errors, and features like filtered, delayed, and past event subscriptions that offer more control than traditional patterns.
A micro-library for creating and observing events.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Subscriptions cancel automatically when the observer deallocates, preventing memory leaks without manual cleanup, as emphasized in the 'attach-and-forget observation' feature.
Events are strongly typed, reducing runtime errors and improving code reliability, which is a core philosophy highlighted in the README's 'Type-safety' section.
Supports filtered, delayed, queued, and past event subscriptions, allowing fine-grained control over callbacks without extra boilerplate, detailed in the 'Advanced topics'.
Simplifies event handling by replacing verbose delegate patterns with simple signal subscriptions, as shown in the comparison to traditional delegation steps.
Signals is built for Swift and only supports iOS, watchOS, and macOS, making it unsuitable for cross-platform development or projects using other languages like Objective-C.
Compared to RxSwift or Combine, it lacks advanced features such as error handling streams, comprehensive operators, or built-in backpressure management, focusing on simplicity over complexity.
The use of the '=>' operator for firing signals, while convenient, deviates from standard Swift patterns and may lead to readability issues or onboarding challenges for new team members.