A Sealed Result Type
Model success and failure without throwing everywhere.
Failures Are Normal
Networks drop and data goes missing. In shared code you want to model these as expected outcomes, not surprise crashes the apps must catch.
Why Not Just Throw?
Throwing exceptions across the Kotlin-to-Swift bridge is fragile. A returned value describing success or failure is far easier for both apps to consume. 🙂
All lessons in this course
- A Sealed Result Type
- Catch Network & Parsing Errors
- Map Errors to UI Messages
- Retry & Offline Fallbacks