You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking at refactoring an existing iOS app's deep link URL handling to use this, loving the type safety and bi-directionality for link generation.
Right now, I have two different error cases to distinguish unrecoverable (things we've messed up, like a config problem) and recoverable (might be solved by an app update, i.e. a newly introduced endpoint) errors. That way I can provide a more useful error message and recovery suggestion to the user.
Is it possible to accomplish this within swift-url-routing and/or swift-parsing?
In more concrete terms, my router looks something like this; see the inline comments for the desired behavior.
OneOf{/// Universal LinksRoute(.case(RootRoute.universalLink)){OneOf{Scheme("http")Scheme("https")}Host("www.example.com")// IDEALLY: throw unrecoverable error if scheme/host doesn't match
appRouter
// All other routing errors are considered recoverable, and I could just do a non-specific catch and re-throw my own error type}/// Legacy deep linksRoute(.case(RootRoute.legacyDeepLink)){Scheme("myapp")// IDEALLY: throw unrecoverable error if scheme doesn't matchHost("preview")// IDEALLY: throw unrecoverable error if host doesn't match
onDevicePreviewRouter
// All other routing errors are considered recoverable, and I could just do a non-specific catch and re-throw my own error type}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm looking at refactoring an existing iOS app's deep link URL handling to use this, loving the type safety and bi-directionality for link generation.
Right now, I have two different error cases to distinguish unrecoverable (things we've messed up, like a config problem) and recoverable (might be solved by an app update, i.e. a newly introduced endpoint) errors. That way I can provide a more useful error message and recovery suggestion to the user.
Is it possible to accomplish this within
swift-url-routing
and/orswift-parsing
?In more concrete terms, my router looks something like this; see the inline comments for the desired behavior.
Beta Was this translation helpful? Give feedback.
All reactions