Schafkopf-Server/Sources/App/Extensions/Optional+Extensions.swift

19 lines
285 B
Swift
Raw Normal View History

2022-10-12 19:28:28 +02:00
//
// File.swift
//
//
// Created by CH on 12.10.22.
//
import Foundation
extension Optional {
func unwrap(or error: @autoclosure () -> Error) throws -> Wrapped {
guard let unwrapped = self else {
throw error()
}
return unwrapped
}
}