Questions tagged [rx-cocoa]

238 questions
1
vote
0 answers

RxSwift Subscribe onNext not called after bind

I am using RxSwift 4.0 and build tableView content using DTTableViewManager in Presenter, I have model variable 1 lazy var mostRecent: TableTitleHeaderContainer = { let container = TableTitleHeaderContainer(isHidden: true, title: "Title 1") …
1
vote
0 answers

How to handle errors in view controller in the MVVM model

Following is my code to make a request and bind it to a UI element func signUpService(_ signUpButtonTap: Observable, _ userAndPassword: Observable<(String, String)>) -> Observable { return signUpButtonTap …
A.S
  • 798
  • 1
  • 10
  • 32
1
vote
1 answer

RxSwift trigger observable on button tap

I am creating a custom observable that will present a UIAlertController which would like to trigger an API Call when pressed. However, I can't seem to get the Alert to pop unless I manually subscribe to it. Is there a way to get this triggered from…
slik
  • 5,001
  • 6
  • 34
  • 40
1
vote
2 answers

Chain observables in ViewModel for fetch but leave as independent properties

I have a MapViewModel for my MapViewController. I have a MapObjectService with a function fetchMapObjects(currentLocation: CLLocation) that returns an Observable In the MapViewModel I have: var currentLocation:…
MayNotBe
  • 2,110
  • 3
  • 32
  • 47
1
vote
2 answers

RxCocoa - prevent multiple view controller pushes when there's lag

As is the case with both Reactive and non-Reactive iOS projects alike, if you have a UI element (e.g. a button or a table view cell that is being selected) that pushes a view controller onto the navigation stack, if there's lag for some reason…
shim
  • 9,289
  • 12
  • 69
  • 108
1
vote
1 answer

How to navigate through UITextFields (Next / Done Buttons) with Rx

How can you navigate through textfields with the next / done keyboard buttons, only using RxSwift + RxCocoa?
Kádi
  • 2,796
  • 1
  • 16
  • 22
1
vote
1 answer

How to toggle editButtonItem with rxswift?

I have the following setup override func viewDidLoad() { super.viewDidLoad() navigationItem.leftBarButtonItem = editButtonItem navigationItem.leftBarButtonItem?.rx.tap.subscribe(onNext: { [weak self] _ in print("edit…
0rt
  • 1,325
  • 2
  • 17
  • 25
1
vote
2 answers

TableView made with RxSwift/RxCocoa glitches after a data change in the Variable it's bound to

The tableView that my variable is bound to jumps/glitches when the cell that I clicked on to trigger the data change. Here is how the tableView and variable are bound: variable.asObservable() .bind(to: tableView.rx.items) {…
Micah Simmons
  • 2,078
  • 2
  • 20
  • 38
1
vote
2 answers

Chaining RxSwift observable with different type

I need request different types of models from network and then combine them into one model. How is it possible to chain multiple observables and return another observable? I have something like: func fetchDevices() ->…
Vitalii Gozhenko
  • 9,220
  • 2
  • 48
  • 66
1
vote
2 answers

How to set image to UIButton by using RxCocoa

I'm very new to RxSwift and RxCocoa. I want to set image to UIButton by using RxCocoa. settingButton.rx.image(for: .normal).onNext(UIImage.init(named: "closeButton")) Any one have idea how to set image to UIButton? Am i doing right?
Yalamandarao
  • 3,852
  • 3
  • 20
  • 27
1
vote
1 answer

Subscribe to UINavigationController back button with RxSwift / RxCocoa

I have a simple test project with a UINavigationController as my rootViewController. I push the first ViewController which has a + button as right bar button item, I subscribe to its taps to present a new ViewController (which is identical to the…
Luca
  • 303
  • 2
  • 13
1
vote
1 answer

RXSwift flatmap that returns from an async completion handler

I am trying to create a searchBar that searches for addresses via a MKLocalSearch with request and using RXSwift and binding to RXCocoa So far i have done the following 1. filter and debounce to avoid too many requests: let searchRes =…
EmilDo
  • 1,177
  • 3
  • 16
  • 33
1
vote
1 answer

Rxswift Update Tableview cell value

I am able to bind an Observable sequence of data to a table. Now lets say i have a button on each cell which on click changes the label of that cell to new value. How to do this ? I have done so far as follows I have created an @IBAction for that…
LynAs
  • 6,407
  • 14
  • 48
  • 83
1
vote
1 answer

Observe a string and get from API with RxSwift

I have a MVVM test project to experiment RxSwift. I have a UItextfield a button. User write a food name, click on the button and a get from an API is triggered to get all recipes with that food. View model struct FoodViewModel var…
Ludovic
  • 1,992
  • 1
  • 21
  • 44
1
vote
1 answer

Handle errors but stay subscribed to original Observable

Let's say I have an button and every time that button is tapped I would like to perform a network request and bind the results to a view on the main scheduler. I also need to deal with the chance that this network request might fail. Here was my…
Scott H
  • 1,509
  • 10
  • 14