Questions tagged [rx-cocoa]
238 questions
7
votes
2 answers
Binding a SwiftUI Button to AnySubscriber like RxCocoa's button tap
I use the following UIViewController and RxSwift/RxCocoa based piece of code to write a very simply MVVM pattern to bind a UIButton tap event to trigger some Observable work and listen for the result:
import UIKit
import RxSwift
import…

JAHelia
- 6,934
- 17
- 74
- 134
7
votes
1 answer
How to properly combine multiple Drivers with RxSwift?
I'm combining a viewDidAppear and filter Drivers with RxSwift. And they work great. But when I introduce a third Driver, it stops calling flatMapLatest on the latest combine.
In my View Controller, I have these Drivers:
let filter:…

nmdias
- 3,888
- 5
- 36
- 59
7
votes
1 answer
How to replace UICollectionViewDelegateFlowLayout by a reactive(RxSwift) call?
Is there a way to replace the method
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize
from the UICollectionViewDelegateFlowLayout protocol by…

Marcone
- 855
- 2
- 8
- 17
6
votes
1 answer
Value of type * has no member 'rx'
I'm trying to make a small reactive wrapper for ImageDownloader from AlamofireImage:
import Foundation
import UIKit.UIImage
import AlamofireImage
import RxCocoa
import RxSwift
extension Reactive where Base: ImageDownloader {
public func…

swearwolf
- 327
- 3
- 10
6
votes
2 answers
Add a rx.value to my CustomView
Lets say i have a CustomView with a value in it.
I want to expose that value to the world using rx.value (Observable) instead of having to access it by value (Int).
final class CustomView: UIView {
var value: Int = 0
...
}
I copied this from…

Godfather
- 4,040
- 6
- 43
- 70
6
votes
4 answers
How to update a tableview's cell based on values from other cells using MVVM/RxSwift?
I'm new to RxSwift and trying to learn by creating a simple signup form. I want to implement it using a UITableView (as an exercise, plus it will become more complicated in the future) so I'm currently using two types of cells:
A…

phi
- 10,634
- 6
- 53
- 88
6
votes
2 answers
NSTableview with RXSwift and RxCocoa for OSX
How do I populate the NSTableview with an array using reactive framework?
In iOS for UITableview:
self.viewModel.arrayElements.asObservable()
.observeOn(MainScheduler.instance)
.bind(to: detailsTableView.rx.items(cellIdentifier:…

Padma
- 83
- 7
6
votes
3 answers
Bind two UIview fram/Position using Rxswift
I want to change view2 position automatically when view1 position will change and bind the both view position using Rxswift.
I try to observe view frame/position using this
view.rx.observe(CGRect.self,"frame")
.subscribe(onNext: {
…

Chirag Desai
- 827
- 8
- 13
6
votes
2 answers
UIRefreshControl with RxSwift
Hi I am trying to make a UIRefreshControl work with RxSwift. Therefore I am using the Activity Indicator that is in the RxSwift Example.
In my viewModel I have the following function and variable to get my data.
// MARK: - Variables
var data =…

Reshad
- 2,570
- 8
- 45
- 86
6
votes
2 answers
RxSwift and UIPickerView
Is there a way to bind a UIPickerView with an Observable?
For example for a UITableView I would do:
myObservableArray.bindTo(tableView.rx.items(cellIdentifier: "Identifier", cellType: MyCustomTableViewCell.self)) { (row, title, cell) in
…

TheoK
- 3,601
- 5
- 27
- 37
5
votes
1 answer
How to get RxSwift autocomplete to work in Xcode 10.1?
Just started learning RxSwift. Why is the autocomplete not working, even though rx commands build fine?
EDIT: Temporary solution may be to add asObservable but I want the full experience!

Gintas_
- 4,940
- 12
- 44
- 87
5
votes
2 answers
RxSwift observing changes in array
Let say we have array of InvoiceDataModel
private let invoices Variable<[InvoiceDataModel]> = Variable([])
class InvoiceDataModel {
let id: Variable
var entity: Variable
var isSelected: Variable
}
On tap on…

Piotr Gawłowski
- 189
- 1
- 10
5
votes
1 answer
RxSwift and isSelected property on UIButton
I have three buttons and I want them to be selected only one at a time:
and:
etc...
My approach is this:
class MyController: UIViewController {
@IBOutlet var buttonOne: UIButton!
@IBOutlet var buttonTwo: UIButton!
@IBOutlet var…

TheoK
- 3,601
- 5
- 27
- 37
5
votes
1 answer
Create ControlProperty for custom UIControl
Is it possible to make extension of structure Reactive, where base class is my custom control inherited from UIControl?
When I'm trying following code:
extension Reactive where Base: CustomControl {
public var value: ControlProperty…

Dmitriy Stupivtsev
- 832
- 1
- 8
- 17
5
votes
0 answers
RxSwift/RxCocoa: Code Completion barely working
I'm trying to learn RxSwift by sample code, tutorials etc, but since most tutorials are for Swift 2 and previous versions of RxSwift, syntax have changed a bit. Normally that wouldn't be a problem, as it is possible to find the new syntax by code…

Mattias
- 415
- 3
- 13