Engineering

Launching Require library.

Optional protect the runtime errors in Swift.

But, sometimes I've tired to wrapping values.
For example, in method chaining in RxSwift.

value.asObservable()
  .flatMap { [weak self] in
    guard let _self = self else {
      return Observable.empty()
    }
    return Observable.just(_self.converted())
}

Using flatMap because Value doesn't want to be Optional.
Just unwrap it and use 3 lines 😲
But, as we know map or flatMap can use throw.

I've created Require.
It can be easily unwrapping.

value.asObservable()
  .map { [weak self] in
    try self.require().converted()
}