Observable alternatives and similar libraries
Based on the "Reactive Programming" category.
Alternatively, view Observable alternatives based on common mentions on social networks and blogs.
-
ReactiveCocoa
Cocoa framework and Obj-C dynamism bindings for ReactiveSwift. -
OpenCombine
Open source implementation of Apple's Combine framework for processing values over time. -
RxCoordinator
๐ Powerful navigation library for iOS based on the coordinator pattern -
Tokamak
SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms [Moved to: https://github.com/TokamakUI/Tokamak] -
Katana
Swift Apps in a Swoosh! A modern framework for creating iOS apps, inspired by Redux. -
RxAlamofire
RxSwift wrapper around the elegant HTTP networking in Swift Alamofire -
Interstellar
Simple and lightweight Functional Reactive Coding in Swift for the rest of us. :large_orange_diamond: -
RxAutomaton
๐ค RxSwift + State Machine, inspired by Redux and Elm. -
NSObject-Rx
Handy RxSwift extensions on NSObject, including rx.disposeBag. -
Verge
๐ฃ A robust Swift state-management framework designed for complex applications, featuring an integrated ORM for efficient data handling. -
RxMediaPicker
A reactive wrapper built around UIImagePickerController. -
VueFlux
:recycle: Unidirectional State Management Architecture for Swift - Inspired by Vuex and Flux -
Komponents ๐ฆ
๐ฆ React-inspired UIKit Components - โ ๏ธ Deprecated -
ReactiveTask
Flexible, stream-based abstraction for launching processes -
TemplateKit
React-inspired framework for building component-based user interfaces in Swift. -
RxReduce
Lightweight framework that ease the implementation of a state container pattern in a Reactive Programming compliant way. -
LightweightObservable
๐ฌ A lightweight implementation of an observable sequence that you can subscribe to. -
RxMultipeer
A testable RxSwift wrapper around MultipeerConnectivity -
Aftermath
:crystal_ball: Stateless message-driven micro-framework in Swift. -
ReactiveArray
An array class implemented in Swift that can be observed using ReactiveCocoa's Signals -
OneWay
A Swift library for state management with unidirectional data flow. -
SimpleApiClient
A configurable api client based on Alamofire4 and RxSwift4 for iOS. -
ACKReactiveExtensions
Set of useful extensions for ReactiveSwift & ReactiveCocoa -
ReactiveLocation
ReactiveCocoa wrapper for CLLocationManager. -
BindKit
Two-way data binding framework for iOS. Only one API to learn. -
STDevRxExt
STDevRxExt contains some extension functions for RxSwift and RxCocoa which makes our live easy. -
RxAlamoRecord
RxAlamoRecord combines the power of the AlamoRecord and RxSwift libraries to create a networking layer that makes interacting with API's easier than ever reactively.
WorkOS - The modern identity platform for B2B SaaS
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of Observable or a related project?
README
Observable is the easiest way to observe values in Swift.
How to
Create an Observable and MutableObservable
Using MutableObservable
you can create and observe event.
Using Observable
you can observe event, in order to avoid side-effects on our internal API.
class SomeViewModel {
/// Public property, that can be read / observed by external classes (e.g. view controller), but not changed.
var position: Observable<CGPoint> = {
return positionSubject
}
// Or use the helper method Observable.asObservable()
// lazy var position = positionSubject.asObservable()
/// Private property, that can be changed / observed inside this view model.
private let positionSubject = MutableObservable(CGPoint.zero)
}
Create Observer with custom onDispose functionality
In some cases Observables require resources while they're active that must be cleaned up when they're disposed of. To handle such cases you can pass an optional block to the Observable initializer to be executed when the Observable is disposed of.
url.startAccessingSecurityScopedResource()
let observable = Observable([URL]()) {
url.stopAccessingSecurityScopedResource()
}
Model Properties as @MutableObservable
Now mark your binded/mapped properties as observable and export public observable
//Private Observer
@MutableObservable var text: String = "Test"
//add observer
_text.observe { (newValue, oldValue) in
print(newValue)
}.add(to: &disposable)
//Public Observer
var textObserve: ImmutableObservable<String> {
return _text
}
Add an observer
position.observe { p in
// handle new position
}
Add an observer and specify the DispatchQueue
position.observe(DispatchQueue.main) { p in
// handle new position
}
Change the value
position.wrappedValue = p
Stop observing new values
position.observe {
// This will stop all observers added to `disposal`
self.disposal.dispose()
}.add(to: &disposal)
Memory management
For a single observer you can store the returned Disposable
to a variable
disposable = position.observe { p in
For multiple observers you can add the disposable to a Disposal
variable
position.observe { }.add(to: &disposal)
And always weakify self
when referencing self
inside your observer
position.observe { [weak self] position in
Installation
CocoaPods
Observable is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'Observable'
Swift Package Manager
Observable is available through Swift Package Manager
.
Swift Package Manager (SwiftPM) is a tool for automating the distribution of Swift code.
It is integrated into the swift compiler and from Xcode 11, SwiftPM got natively integrated with Xcode.
dependencies: [
.package(url: "https://github.com/roberthein/Observable", from: "VERSION")
]
Migrations
1.x.y to 2.0.0
Observable
is nowMutableObservable
ImmutableObservable
is nowObservable
Observable.asImmutableObservable()
is nowObservable.asObservable()
Observable.value
is nowObservable.wrappedValue
Suggestions or feedback?
Feel free to create a pull request, open an issue or find me on Twitter.