A lightweight Swift library for observing and binding values, designed to support MVVM architecture in iOS apps.
Hanson is a lightweight Swift library for observing and binding values, designed to support the MVVM architecture in iOS applications. It provides a Swiftier alternative to KVO with no boilerplate code, allowing developers to observe changes in pure Swift types and UIKit properties. The library simplifies reactive programming by enabling easy value observation, binding between observables, and thread-safe event handling.
iOS, macOS, watchOS, and tvOS developers building Swift applications who need a simple, lightweight solution for observing and binding values, especially those adopting MVVM architecture.
Developers choose Hanson for its minimal API, elimination of KVO boilerplate, and seamless integration with both pure Swift types and Apple's frameworks. Its lightweight design and support for custom schedulers make it ideal for projects that need reactive patterns without the overhead of larger frameworks.
Lightweight observations and bindings in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Replaces verbose KVO boilerplate with a clean, intuitive API for observing values in Swift, as shown in the example where `observe(observable)` simplifies change detection.
Wraps UIKit/AppKit KVO properties with type-safe observables using `dynamicObservable`, enabling easy observation of native framework properties without manual KVO setup.
Allows automatic value propagation between observables with `bind()`, reducing boilerplate in MVVM patterns for synchronizing view models and views, as demonstrated with activity indicator binding.
Includes `MainThreadScheduler` to ensure UI updates are safely delivered on the main thread from background observations, enhancing reliability in multi-threaded environments.
Lacks advanced operators like map, filter, or combine found in libraries like RxSwift or Combine, restricting complex data stream transformations and compositions.
The README doesn't address error handling in observables or bindings, forcing developers to implement ad-hoc solutions for fault-tolerant applications.
With dependencies on Xcode 8 and no mention of SwiftUI or modern Swift concurrency, it may not be actively maintained for current development trends, risking compatibility issues.