Hey, great reading so far.
I’ve written my custom Rx alert view controller extension and removed the previous UIKit related showMessage(_:description:) code.
How does the original block of code that calls the show methods inside the actionSave function change now that the showMessage
method returns an observable while also integrating that with the events emitted by PhotoWriter?
@IBAction func actionSave() {
guard let image = imagePreview.image else { return }
PhotoWriter.save(image)
.subscribe(
onError: { [weak self] error in
self?.showMessage("Error", description: error.localizedDescription)
},
onCompleted: { [weak self] in
self?.showMessage("Saved")
self?.actionClear()
})
.disposed(by: self.disposeBag)
}