RxSwift/RxExample/RxDataSources/DataSources/Optional+Extensions.swift

22 lines
464 B
Swift

//
// Optional+Extensions.swift
// RxDataSources
//
// Created by Krunoslav Zaher on 1/8/16.
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
//
import Foundation
extension Optional {
func unwrap() throws -> Wrapped {
if let unwrapped = self {
return unwrapped
}
else {
rxDebugFatalError("Error during unwrapping optional")
throw RxDataSourceError.unwrappingOptional
}
}
}