I recently attempted to create a subclass of NSTextField
that would also let me use the convenience initializer init(labelWithString:)
. However, because of the rules for initializer delegation for class types, I can't call init(labelWithString:)
from any of my subclass's designated or convenience initializers. If I had access to the source code I could simply reuse it in my subclass's implementation, but because I don't I have to reverse engineer its behavior instead. Is this really the only way to reproduce the behavior of a superclass's designated initializer, or am I missing something?
(I'm aware that one possible workaround is automatic initializer inheritance—via Rule 2—but I can't implement all of NSTextField
's designated initializers because my subclass has a stored property that wouldn't be set by them unless I made it an optional value.)