RxSwift: Better Error Handling With CompactMap

Use one of RxSwift 5’s newest features to streamline your code.

Study RxSwift long enough, say, a week or so, and you’re bound to run across some variant of the following code:

class NoErrorViewModel {    var data: Observable<[String]>!
var dataService = DataService()

--

--

--

I write about Apple, Swift, and technology. I’m a Lead iOS engineer at CRi Solutions, a leader in cutting edge mobile corporate and financial applications.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

What Is The W3C And Why it Matters

Ever wanted to make a mobile app? These are 6 aspects to think about.

How To Use An IP Geolocation API For Traffic Management

ElasticBeats vs pure Python: creation of a simple web poller

AWS S3 New Update

Giblemac — EzCrackMe

Software Desgin Patterns

Fullstack Academy: Review

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Michael Long

Michael Long

I write about Apple, Swift, and technology. I’m a Lead iOS engineer at CRi Solutions, a leader in cutting edge mobile corporate and financial applications.

More from Medium

How to Add Amazing Frame-by-frame Animations in SwiftUI

Should we write unit tests for network classes?

Abstract Factory Pattern in Swift

How a custom keyboard can extend your app’s capabilities