Group Group Group Group Group Group Group Group Group

Chapter 6: Question on "Dependency Injection"

Always trying to learn, so I’m curious about the code added to RegisterView.swift to initialize the keyboardHandler property:

init(keyboardHandler: KeyboardFollower) {
  self.keyboardHandler = keyboardHandler
}

Why is this code needed? The project seems to work fine without it, the var is not initialized on declaration, so omitting the object when referencing RegisterView is a compile-time error, and passing it in the call to RegisterView initializes the property implicitly.