Hello all!
I am working on a project and have a class that is meant to be subclassed. So it is defined with the open
access modifier. However, I also want it to conform to some protocols that have required initializers (e.g. ExpressibleByNilLiteral
).
I want the base class's implementation of this initializer to stand for all subclasses. However, every time I subclass, the compiler tells me I need to implement that same initializer. So I end up doing something like this:
public required init(nilLiteral: ()) {
super.init(nilLiteral: ())
}
Is this just a limitation of the Swift language, or is there a way to avoid having to do the above for each subclass?