diff --git a/Sources/Inject/Integrations/Hosts.swift b/Sources/Inject/Integrations/Hosts.swift index 8e7d70c..6066bef 100644 --- a/Sources/Inject/Integrations/Hosts.swift +++ b/Sources/Inject/Integrations/Hosts.swift @@ -23,6 +23,7 @@ public typealias ViewHost = _InjectableViewHost open class _InjectableViewControllerHost: InjectViewControllerType { public private(set) var instance: Hosted let constructor: () -> Hosted + public var afterInjectionHook: (() -> Void)? public init(_ constructor: @autoclosure @escaping () -> Hosted) { instance = constructor() @@ -32,8 +33,9 @@ open class _InjectableViewControllerHost: Inje self.enableInjection() addAsChild() - onInjection { instance in + onInjection { [weak self] instance in instance.resetHosted() + self?.afterInjectionHook?() } }