Quick Notes: Designated Init vs Convenience Init
“It was the rainbow gave thee birth, and left thee all her lovely hues.” — W.H. Davies
Designated Initializer (delegates up 🆙 )
- default initializer
- typically there is only one in a class
- but there definitely has to be one at least !!
- seen as a funnel point
- designated init must call super class’ designated init! (inheritance)
- designated init must delegate up! ⬆️
Convenience Init (delegates across)
- secondary / supporting init
- has the keyword ‘convenience’
Use Case 🧰
- provide default values for some initializers
- specific use case
- delegates across: must call another init in the same class!
- ultimately must call a designated init!