I am trying to perform a complex computation in the background upon table row selection but it freezes the UI. Please have a look at my code and tell me what might be wrong.
tableView.rx
.modelSelected(Sring.self)
.flatMap { item -> Observable<String> in
for _ in 1...2_500 {
for _ in 1...1_000 {
}
}
return Observable.just("Hello world!")
}
.subscribeOn(ConcurrentDispatchQueueScheduler(qos: .background))
.observeOn(MainScheduler.instance)
.retry()
.subscribe(onNext: { value in
print(value)
})
.disposed(by: bag)