I have one filter type enum
import RxSwift import RxCocoa
enum FilterType {
case all
case rental
case purchased
}
var currentCategory: Driver<FilterType> = Driver.just(.all)
whenever I am updating the currentCategory on segment click. like below currentCategory = Driver.just(.purchased).
I am always getting the same value all every time. I am new to RXSwift and RXCocoa. Please help me to get out of this situation. Thanks in advance.
You are using RxSwift in incorrect way: every time when you assign to
currentCategory, your subscriptions gets disposed. You need to use different approach:and then in your code set new value for BehaviorRelay:
or bind it to your UI control: