rx-swift

RxSwift enable/disable button based on textfield input

烈酒焚心 提交于 2021-02-11 12:29:42
问题 I have to implement below scenarios with RxSwift MVVM I have two textfields (OTP & Confirm OTP) and a Submit button, If user clicks on the OTP textfield when there is no value on the OTP textfield then submit button should be disabled, Now if user types something in otp textfield button should be enabled. Now if user taps on the second text field as it is blank now then the button should be disabled again & its get enabled only when there is a value. So basically I want to enable/disable the

RxSwift - Recursive Observables?

自古美人都是妖i 提交于 2021-01-28 05:30:20
问题 Learning RxSwift - Here's my Problem: i have a webservice that fetches data using an active access token, whenever the token expired , then first call the token generate api and then call the current request to run again. so that it will have an active access token to valid results. but i have problem in getting the response for token and then call the prev. request? so i tried adding an observable request , then in response check if the token is invalid, then call another observable to

How to observe object's property in RxSwift?

一个人想着一个人 提交于 2020-12-11 02:12:13
问题 I have the following Forecast class: class Forecast { let city: City var currentTemperature: String { didSet { print("cur tepm was set to \(currentTemperature)") } } init(city: City) { self.city = city self.currentTemperature = "0" } func loadForecast() { self.currentTemperature = "+10" } } I am trying to observe currentTemperature property of forecast object in ForecastViewModel class ForecastViewModel { fileprivate let variableForecast: Variable<Forecast> var navigationTitle: Observable

Get model from UICollectionView indexpath

余生颓废 提交于 2020-08-08 05:34:06
问题 I'm using RxSwift to bind a model array to a collection view How do I get the model object from a given indexPath? I'm doing the binding like this: vm.bikeIssueCatagories() .drive(self.collectionView.rx.items(cellIdentifier: "BikeIssueCategoryCollectionViewCell", cellType: UICollectionViewCell.self)) { row, data, cell in }.disposed(by: disposeBag) The core of my issue is, that I need to get both the model object and the cell that a user selects. Using collectionView.rx.modelSelected(T.self)