I guess my answer is a solid “it depends”. (A lot of help there, right?)
It depends on the type of application. Even there, it can sometimes depend on a specific view model and the type of interactions available.
Sometimes I do the pure Rx flow but that’s really only possible if the things your observing have an Rx component (say, the tap publisher on a button). After all, something has to produce (publish) the events to which you’re responding.
Sometimes on list style screens I simply publish a enum state for loading, loaded(data), error(message). And sometimes I do things like…
class AccountDetailsViewModel { var loading = BehaviorRelay(value: true) lazy var title = accountInformation
.map { $0.name } lazy var accountDetails = accountInformation
.map { Array($0.details.prefix(2)) }
lazy var paymentDetails = accountInformation
.map { Array($0.details.dropFirst(2)) } lazy var footnotes = accountInformation
.map { $0.footnotes } private var accountInformation = PublishSubject<AccountInformation>() func load() {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
self.accountInformation.onNext(AccountInformation.sample)
self.loading.accept(false)
}
}
}
Where there’s an internal publisher that feeds the view model’s observables.
And I’ve yet to do an app with a single global Redux-style state management system.
So… it depends. I kind of dislike solutions like RxFeedback, as they tend to have a lot of boilerplate code and methodology associated with them. And also because I feel that with them you start to fall into the “every problem looks like a nail” paradigm.
Some will say that unless you’re doing everything, from source events to final subscriptions, in a Rx flow you’re not really doing “true” Rx, and it’s entirely possible that I’m not. I’m aware of “best practices”, but I’m also trying to fit the tools I have to the job at hand and a “best practice” that works in situation A may not be best for situation B.
Keep in mind too that SwiftUI is on the horizon, and it’s full of publishers and @State and @Binding variables, and operates very much in the completion handler/call function/set state world of system architecture.
Not sure I was a lot of help, and my answers might be generating more questions than answers, but hey, if it were easy they wouldn’t need us, right?