I would need an Observable, for example to provide a system clock, which does not need to pass anything in onNext(). I couldn\'t find a signature that would allow me to do that.
I don't know this will helps you or not.
The code written in RxSwift
.
// Create an observable and emit somethings
let myObservable = Observable.create{ observer in
observer.on(.next(Void()))
return Disposables.create()
}
// Observer subscribe changes
myObservable.subscribe(onNext: {
_ in
print("Hello")
}).disposed(by: disposeBag)
Or use the Variable object
// Create a Variable object that contanins nothing
var myValueWatcher:Variable = Variable(Void())
// Observer subscribe changes
myValueWatcher.asObservable().skip(1).subscribe(onNext: {
_ in
print("Changes!")
}).disposed(by: disposeBag)
// The emit code
myValueWatcher.value = Void()