Questions tagged [rx-cocoa]

238 questions
5
votes
1 answer

RxSwift. CombineLatest. Not all observables emitted

Observable.combineLatest(...){...} contains several observables, but some of these observables were not emitted. combineLatest emits only when all observables in this method were emitted. How to skip not emitted observables and emit…
Igor Kasuan
  • 792
  • 2
  • 10
  • 25
5
votes
2 answers

How to bind UISwitch to UIButton enable in RxSwift?

I have a UISwitch that needs to be selected in order to continue onto the next form screen. So I would like to bind the UISwitch selected to the UIButton enabled. I just can't get this sample going. Here's what I'm trying but doesn't compile: let…
TruMan1
  • 33,665
  • 59
  • 184
  • 335
4
votes
3 answers

Hide view and apply hide effect - Swift

I want to give an alpha effect when closing the button's visibility with the code below. However, in the code below, the alpha effect works correctly, but instantly becomes , without waiting for 0.5 seconds of visibility. Do you have alternative…
Ümit Bülbül
  • 512
  • 2
  • 15
4
votes
1 answer

UITableView with RxCocoa is not observing correctly to contentOffset property

I have an issue with observing the contentOffset property of UITableView with RxCocoa. I've tried RxCocoa property: view.tableView.rx.contentOffset .mapAt(\.y) .subscribe(onNext: { print($0) }) And in console I see…
Andrei Krotov
  • 306
  • 1
  • 10
4
votes
1 answer

Is it possible to map to a "fallback" Decodable using RxSwift and Moya?

I am using RxMoya for the network layer of my app and I'm having a case where the server can either send the expected response (let's say a User), or an error object, both with status code 200. For example: { "name": "john doe", "username":…
phi
  • 10,634
  • 6
  • 53
  • 88
4
votes
1 answer

RxTest: Undefined symbols for architecture x86_64 and arm64

I am trying to run the following test from Chapter 16: Testing with RxTest of Raywenderlich RxSwift book: import XCTest import RxSwift import RxTest @testable import Testing class TestingViewModel : XCTestCase { var viewModel: ViewModel! var…
Hamed Ghadirian
  • 6,159
  • 7
  • 48
  • 67
4
votes
3 answers

RxSwift - trigger search programmatically in UISearchBar

I am observing UISearchBar.rx.text attributes to perform some search related Action when User types some text. But at some time, I also would like to trigger this search Action programmatically. For instance at the creation of the view like in this…
PhilippeC
  • 51
  • 1
  • 3
4
votes
3 answers

Get model from UICollectionView indexpath

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:…
Wiingaard
  • 4,150
  • 4
  • 35
  • 67
4
votes
3 answers

RxSwit - driver from observable ignoring errors

Let's say I have some view initally filled with some data. Than I fetch data over network and want to update view with this updated data. At this point I want to create Driver from this observable to drive UI elements. However in case of error in…
Wujo
  • 1,845
  • 2
  • 25
  • 33
4
votes
1 answer

RxSwift + UITableViewCell how to get cell object in heightForRowAt

I have a view controller with UITableView. The table data is populated using RxSwift: let observable = Observable.just(data) observable.bindTo(tableView.rx.items(cellIdentifier: "CategoryCell", cellType: CategoryCell.self)) { (row, element, cell)…
Gasim
  • 7,615
  • 14
  • 64
  • 131
4
votes
1 answer

RxSwift - Textfield-Variable binding in tableview

I'm new to RxSwift and I have this code to setup a tableview which contains a textfield: budget.expenses.asObservable() .bindTo(tableView.rx.items(cellIdentifier: ExpenseInputCell.cellIdentifier, cellType: ExpenseInputCell.self)){(row, element,…
user2529173
  • 1,884
  • 6
  • 30
  • 43
4
votes
5 answers

Observable for selector - RxSwift

I'm trying to migrate my FRP understanding from ReactiveCocoa 2.5 to RxSwift and I have one misunderstanding. In ReactiveCocoa, I used rac_signalForSelector when I wanted to observe an invocation of a method. Is there any way to implement this logic…
Nikita Ermolenko
  • 2,139
  • 2
  • 19
  • 41
3
votes
2 answers

How to populate custom header/footer view when using RxDatasources for datasource

I am using RxDatasources to create my datasource. Later on, I configure cells in my view controller. The thing is, cause headers/footers has nothing with datasource (except we can set a title, but if we use custom header footer, this title will be…
Whirlwind
  • 14,286
  • 11
  • 68
  • 157
3
votes
1 answer

RxSwift: how to subscribe to change of an array element member change?

Let's say we have a class Dog class Dog { let age = BehaviorRelay(value: 1) } and somewhere we have an array property with all the dogs let dogs = BehaviorRelay<[Dog]>(value: [..., ...]) now I want to create UI which needs array of dogs…
iago849
  • 1,818
  • 1
  • 13
  • 9
3
votes
1 answer

validate form with checkbox button RxCocoa/RxSwift

I need to validate the form with a radio button, but I can't do it, I share my code: My View: private func registerForm() { tvUserName.rx.text.map { $0 ?? "" }.bind(to: viewModel.userNamePublishSubject).disposed(by: disposeBag) …
Cesar Quiroga
  • 97
  • 1
  • 5
1 2
3
15 16