What is Signals?

Signals is an eventing library that enables you to implement the Observable pattern without using error prone and clumsy NSNotifications or delegates.

Introduction

NSNotifications are inherently error prone. Prior to iOS 9, if a listener doesn’t de-register itself from a notification when it’s deallocated, firing the notification will crash the application. If you refactor the data you send with a notification, the compiler won’t warn you but your app might crash at runtime.

NSNotifications are also unnecessarily broad. Anyone can listen in on them which couples separate components in your application implicitly together.

With NSNotifications you register a selector to be invoked when a notification fires. This makes code less readable by separating where you register for notifications and where you handle notifications.

NSNotifications also require a lot of boilerplate code to register unique names to use as notification identifiers.

Signals solves all of the above problems and provides an inline, type-safe and attach-and-forget way to observe events being fired by objects. It is also a great replacement for delegates when there is no need to return data from the delegates.

Features:

  •  Type-safety
  •  Attach-and-forget observation
  •  Configurable observation behaviour
  •  Separate callback queues
  •  Comprehensive Unit Test Coverage

Overview

  • Pricing: Free
  • Resource Link: https://github.com/uber/signals-ios
  • Resource Maker: Uber Open Source
  • Mobile Platform Destination: iOS Apps
  • Mobile Platform Support: Native iOS
  • Programming Languages: Objective-C
  • iOS Versions Supported: iOS 9.0+, iOS 10.0+, iOS 11.0+, iOS 12.0+
  • CocoaPods: UberSignals
  • Carthage: uber/signals-ios