Group Group Group Group Group Group Group Group Group

Chapter 6 Dependency Injection not working

I’m getting an error on the init injection dependency. Here’s the code in having problem with
init(keyboardHandler: KeyboardFollower) {
self.keyboardhandler = keyboardhandler
}
And the error is
‘self’ used before all stored properties are initialized
There is a red underline under the equal sign.

Oh. I guess I should say that this is in Chapter 6

Is keyboardhandler supposed to be the same as keyboardHandler?

Hi @marvmax,

sorry for replying so late - it looks you’re referencing variables that don’t exist, it should be:

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

Note the camel case format of the variable names, with the 2nd word in uppercase. Please let me know if that fixes your issue.