diff --git a/CHANGELOG.md b/CHANGELOG.md index 05ab8a9..31186d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## 3.0.1 + +* Fix `instantiate()` implementation on `StoryboardSceneBased` ViewControllers. + [@jakubgert](https://github.com/jakubgert) + [#38](https://github.com/AliSoftware/Reusable/pull/38) + ## 3.0.0 * Converted library and Demo project to Swift 3. diff --git a/Sources/Storyboard/StoryboardSceneBased.swift b/Sources/Storyboard/StoryboardSceneBased.swift index 18ff1b9..b628834 100644 --- a/Sources/Storyboard/StoryboardSceneBased.swift +++ b/Sources/Storyboard/StoryboardSceneBased.swift @@ -42,8 +42,8 @@ public extension StoryboardSceneBased where Self: UIViewController { - returns: instance of the conforming ViewController */ static func instantiate() -> Self { - let storyboard = Self().storyboard - guard let vc = storyboard?.instantiateViewController(withIdentifier: self.sceneIdentifier) as? Self else { + let storyboard = (Self.self as StoryboardSceneBased.Type).storyboard + guard let vc = storyboard.instantiateViewController(withIdentifier: self.sceneIdentifier) as? Self else { fatalError("The viewController '\(self.sceneIdentifier)' of '\(storyboard)' is not of class '\(self)'") } return vc