Class initializers in Swift come with one golden rule that catches everyone out the first time. Let's talk about what it is, why it exists, and how to stop forgetting it.

Okay so we need to talk about initializers again. I know, I know β€” we covered them in the structs chapter. But classes have a twist that trips people up the first time they hit it, and it's worth slowing down on before you run into it at 11pm debugging something that seems like it should be obvious.

Here's the short version of what we're going to learn today:

When a child class has its own initializer, it must call the parent's initializer β€” and it has to do it after setting up its own stuff first.

That's it. That's the rule. But let's actually understand why, because "just do it" is a terrible way to remember something. πŸ₯