I have the following type called Maybe
:
enum Maybe<T>:{
case Nothing
case Something(T)
init(){
self = .Nothing
}
init(_ something: T){
self = .Something(something)
}
}
I was expecting this code to call my second initializer, to convert an Int
into a Maybe<NSDate>
:
var c : Maybe<NSDate> = NSDate()
No so. How can I make the above code work (as the builtin Optional
does)?