From 4eed766912fbdb1911c751f0d1cd3b3deb5779cc Mon Sep 17 00:00:00 2001 From: Mark Lilback Date: Thu, 30 Jun 2016 18:34:37 -0400 Subject: [PATCH] when injecting into a window controller, injection is also done on the contentViewController --- Sources/SwinjectStoryboard.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Sources/SwinjectStoryboard.swift b/Sources/SwinjectStoryboard.swift index de0d442..388f74f 100644 --- a/Sources/SwinjectStoryboard.swift +++ b/Sources/SwinjectStoryboard.swift @@ -133,7 +133,9 @@ public class SwinjectStoryboard: _SwinjectStoryboardBase, SwinjectStoryboardType } else { fatalError("A type conforming ResolverType protocol must conform _ResolverType protocol too.") } - + if let windowController = controller as? NSWindowController, let viewController = windowController.contentViewController { + injectDependency(viewController) + } if let viewController = controller as? NSViewController { for child in viewController.childViewControllers { injectDependency(child)