Filters

Hide filters
Platform
Content Type
Difficulty

All Tutorials · 6 Results

Contained in: Intermediate Combine combine
iOS & Swift
Intermediate Combine
Combine has a number of operators to help with handling network data, sharing resources with multiple subscribers, and managing errors. Once those are in place, you can perform unit tests on your Combine pipelines to make sure everything is running error-free…
iOS & Swift

Networking with Combine

Combine comes with 2 special operators, dataTaskPublisher(for:) and decode() that help you fetch data from the network in your Combine pipeline, and decode that data using Swift’s built in decoders such as JSONDecoder
iOS & Swift

Testing Combine Operators

…with all other code, your Combine pipeline code can, and should be, tested. The Given-When-Then pattern is a great way to layout your test code, ensuring that your code works as intended…
iOS & Swift

Sharing Resources

Publishers in Combine are usually passed by value, since they are structs; however, you can use the built in Combine operator share() to pass them by reference, establishing one true subscription and simply sharing the data with other subscribers as they come along. Want to wait until…
iOS & Swift

Mapping Errors

…encountered during execution of the code within the operator. The mapError operator lets developers maintain knowledge of errors encountered, passing them down the Combine pipeline…
iOS & Swift

Retrying and Catching Errors

…need to retry if a failure is encountered. Networking is a great example here. If a download only partially completes, you can use Combine’s retry operator to retry the download. If other errors are encountered, including while retrying, you could try catch ing those errors to keep your…