What could be a reason that initCompleted would not be hit even if the class itself has been initialized?
defaultContainer.register(Foo.self) { _ in
Foo()
}.initCompleted { resolver, foo in
// this is not hit
}.inObjectScope(.container)
initCompleted is never hit but I have:
let foo: Foo = Foo()
called in the initializer of a class and I have checked, that line is hit and the instance of Foo is created.
All the other registrations are working except this one.
I am using v2.0.0
I'm not sure if I understood you correctly: is let foo: Foo = Foo() the code which you expect should call .initCompleted?
If that is so, you are creating an instance in the wrong way - you should not call the initializer directly, but rather through the Swinject container: let foo = container.resolve(Foo.self)
Thank you! That is exactly what I did wrong :)