Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Object-Oriented Swift Inheritance Convenience Initializers

bogdan barbulescu
PLUS
bogdan barbulescu
Courses Plus Student 232 Points

Overriding designated initializers from SuperClass.

Why is this statement true? "When you override a designated initializer from a superclass, you always write the override keyword, even if your subclass implementation of the initializer is a convenience initializer." - Source, Swift 2.2 documentation.

Why do we have to provide an override for a superclass designated initializer that is implemented as a convenience initializer in the subclass? Theoretically, the override convenience initializer from our subclass can not delegate directly to SuperClass delegated initializer.

However, if we implement a convenience initializer from a SuperClass, as a designated/convenience initializer, then the subclass does not have to provide an override.