github.com/muukii/OptionalProtocol

Using `OptionalProtocol` with Generics, you can add a `Optional` type constraint to type parameter `T`


License
MIT

Documentation

OptionalProtocol

CI Status Version License Platform

It is impossible to add a constraint of optional in generics. But, OptionalProtocol will enable that.

Example

func unwrap<T: OptionalProtocol>(object: T) -> T.Wrapped

(object: T) must be Optional

Requirements

Installation

OptionalProtocol is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "OptionalProtocol"

Author

muukii, m@muukii.me

License

OptionalProtocol is available under the MIT license. See the LICENSE file for more info.