Beginning RxSwift - Part 11: Observables, | Ray Wenderlich Videos

Get an overview of your first iOS project, Combinestagram, and then apply what you've learned so far to Rx-ify it.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4743-beginning-rxswift/lessons/11

Hi Scott, thanks for your work.
I’m using MVVM+C architecture pattern in a project, and I’m wondering what is the right way to do this property observation between controllers if the navigation flow process is decoupled from the controllers.
Thank you!

@scotteg Can you please help with this when you get a chance? Thank you - much appreciated! :]

@scotteg Why did you put updateUI() in a new subscription? If you call it immediately after creating the collage in the first subscription the code seems to be working correctly.

@scotteg Do you have any feedback regarding this? Thank you - much appreciated! :]

I heard that Variable is deprecated, are there going to be any updates about that on the course? Should I continue the course regularly and use β€œVariable”, or use other sources to learn how to use other objects, like BehaviorRelay?

@scotteg Can you please help with this when you get a chance? Thank you - much appreciated! :]

Hi @gggal123, apologies for the delay in responding. Yes, Variable is deprecated. You can use BehaviorRelay instead. Thanks

Hi, I also had the same issue. this is my solution without variable. :blush:

let bag = DisposeBag()

let images = BehaviorSubject<[UIImage]>.init(value: [])

    override func viewDidLoad() {
        super.viewDidLoad()
        images.subscribe(onNext: { [weak self] photos in
            guard let preview = self?.imagePreview else { return }
            preview.image = UIImage.collage(images: photos, size: preview.frame.size)
            }).disposed(by: bag)
    }
    
    @IBAction func actionClear() {
        images.onNext([])
    }
    
    @IBAction func actionSave() {
        
    }
    
    @IBAction func actionAdd() {
        do {
            try images.onNext(images.value() + [UIImage(named: "Barcelona.jpg")!])
        } catch (let error) {
            print(error)
        }
    }
1 Like

Please update the lessons as some of the method is deprecated. Thank you.

1 Like

@rastislv Thank you for sharing your solution - much appreciated! :]

@iphoneanshul Thank you for the heads up - much appreciated! We will update the whole course soon.