UnwrapOrThrow
This is a micro-package which simply create the ?!
operator and the unwrap(orThrow:)
convenience on Error
.
Usage
struct VarIsNil : Error {}
let myOptionalVar: Int? = nil
let nonOptionalOrThrow1 = try myOptionalVar ?! VarIsNil()
let nonOptionalOrThrow2 = try myOptionalVar.unwrap(orThrow: VarIsNil())