This is Understanding Combine, written by Matt Neuburg. Corrections and suggestions are greatly appreciated (you can comment here). So are donations; please consider keeping me going by funding this work at http://www.paypal.me/mattneub. Or buy my books: the current (and final) editions are iOS 15 Programming Fundamentals with Swift and Programming iOS 14. Thank you!


AssertNoFailure

.assertNoFailure (Publishers.AssertNoFailure) crashes if a failure comes down from upstream. It also guarantees to the downstream that no failure can arrive, because if it did, we’d have crashed; therefore the downstream failure type is Never.

But do not use .assertNoFailure as a way of changing the failure type to Never! That’s the job of .replaceError or .catch. Use it during development to ensure sanity, but remove it before shipping.

WARNING: Do not ship code containing .assertNoFailure calls! Your app will crash if an error occurs.


Table of Contents