I'm trying to make NSNull
conform to NilLiteralConvertible
, but I'm running into an enormous amount of frustration:
extension NSNull : NilLiteralConvertible{
required convenience init(nilLiteral: ()){
self.init()
}
}
First of all, I'm forced to make the init
a convenience
one, as I can't add designated initialisers in an extension.
Then, the compiler goes crazy and insists that the init must be made required
and immediately after complains that required
initialisers must be added directly to the class and not in an extension. WTF?!
Anybody knows what's going on and how to make NSNull
conform to this simple protocol?
I'm testing this in an Xcode playground.