Navati

Photo by Juanita Swart on Unsplash

“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

Rules 📏

  • 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

Rules 📏

  • delegates across: must call another init in the same class!
  • ultimately must call a designated init!

--

--

Navati

Navati

an iOS dev eager to learn and advocate for women / minorities in tech. A WomenWhoCode Mobile Evangelist + Google’s WTM Ambassador empowers me to do so.