Teapot icon indicating copy to clipboard operation
Teapot copied to clipboard

Request For Feedback: Swift 5 `Result` type

Open designatednerd opened this issue 5 years ago • 6 comments

Should we consider adopting the Swift 5 Result type instead of rolling our own NetworkResult?

Might be nice to use generics instead of a separate result type for images as well.

COMMENTS FIIIIIIIIIIGHT!

designatednerd avatar Mar 28 '19 11:03 designatednerd

I think this could be a good idea. There are some affordances for transforming Result in Swift 5 that could be really useful to callers, and I feel like if there's a standard lib way of doing something extremely similar to what we're already doing, we should probably use that instead of a custom one.

designatednerd avatar Mar 28 '19 11:03 designatednerd

@Elland @csdodd @yuliaveres thoughts?

designatednerd avatar Mar 28 '19 11:03 designatednerd

agree to what @designatednerd says. Would be good to explore Result.

yuliaveres avatar Mar 28 '19 13:03 yuliaveres

I am afraid there will be no comments fight. Looks like Result can easily be swapped in and I don't see any disadvantages of doing so.

csdodd avatar Mar 29 '19 08:03 csdodd

🙃 Y'all are no fun whatsoever.

I'll try to work on a PR for this either today or Monday.

designatednerd avatar Mar 29 '19 13:03 designatednerd

Not sooo sure about easily swapped in, without losing some information. I think the solution for that might be to expand TeapotError to include the results, request data, etc as well.

elland avatar Apr 02 '19 07:04 elland