So you are being a good Swift dev, and started using Result<Success, Failure>
in your code as a return type where necessary.
But, you say, it is an enum
, which is cool, except you need to switch on it or even worse do a case let
dance to get the success value.
There has to be an easier way. Well there is, and it’s all in the name!
func getPurpleThing() -> Result<Thing, Error> { ... }
func doIt() {
guard let thing = try? self.getPurpleThing().get else { return }
}