You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this property in my viewModel, that change the value of my UIImage if my method returns true of false
var image: Observable<UIImage?> {
if musicService.isPlaying() {
return Observable<UIImage?>(UIImage(named: "ic_pause"))
} else {
return Observable<UIImage?>(UIImage(named: "ic_play"))
}
}
Want I want is to be able to update the value of my property and notify its observers that the value changed (or didn't change) without having to image.ObserveNext { } cause I don't have any additional processing to do with the closure.
Example:
func foo() {
// Do something
// image.UPDATE()
}
So basically I want to know if there is another method that I can call, to pass again in my property, return the right image and notify all the observers
The text was updated successfully, but these errors were encountered:
I'm not a contributor on this repository but I do use it at work, and I think you can think about this a little differently. What you're trying to observe seems to be the state of musicService, whether or not it's playing. I assume you're trying to set a UIImageView.image based on this state?
It would make more sense to have musicService.isPlaying be an Observable<Bool>. Then, you could bind that to a field in your viewModel, like so:
Then, whenever you start or stop the music service, you can update isPlaying.value and the image will automatically be updated, and so will any UI components that you have that are observing image.
Hi,
I have this property in my viewModel, that change the value of my UIImage if my method returns true of false
Want I want is to be able to update the value of my property and notify its observers that the value changed (or didn't change) without having to
image.ObserveNext { }
cause I don't have any additional processing to do with the closure.Example:
So basically I want to know if there is another method that I can call, to pass again in my property, return the right image and notify all the observers
The text was updated successfully, but these errors were encountered: