//
//  Storyboard.swift
//  BothamUI
//
//  Created by Davide Mendolia on 03/12/15.
//  Copyright © 2015 GoKarumi S.L. All rights reserved.
//

import Foundation

public struct BothamStoryboard {
    private let name: String
    private let bundle: NSBundle

    public init(name: String, bundle: NSBundle = NSBundle.mainBundle()) {
        self.name = name
        self.bundle = bundle
    }

    private func storyboard(name: String, bundle: NSBundle) -> UIStoryboard {
        return UIStoryboard(name: name, bundle: bundle)
    }

    public func initialViewController<T>() -> T {
        let uiStoryboard = storyboard(name, bundle: bundle)
        return uiStoryboard.instantiateInitialViewController() as! T
    }

    public func instantiateViewController<T>(viewControllerIdentifier: String) -> T {
        let uiStoryboard = storyboard(name, bundle: bundle)
        return uiStoryboard.instantiateViewControllerWithIdentifier(viewControllerIdentifier) as! T
    }

    public func instantiateViewController<T>() -> T {
        return instantiateViewController(String(T.self))
    }
}
//
//  Storyboard.swift
//  BothamUI
//
//  Created by Davide Mendolia on 03/12/15.
//  Copyright © 2015 GoKarumi S.L. All rights reserved.
//

import Foundation

public struct BothamStoryboard {
    private let name: String

    public init(name: String) {
        self.name = name
    }

    private func storyboard(name: String) -> UIStoryboard {
        return UIStoryboard(name: name, bundle: NSBundle.mainBundle())
    }

    public func initialViewController<T>() -> T {
        let uiStoryboard = storyboard(name)
        return uiStoryboard.instantiateInitialViewController() as! T
    }

    public func instantiateViewController<T>(viewControllerIdentifier: String) -> T {
        let uiStoryboard = storyboard(name)
        return uiStoryboard.instantiateViewControllerWithIdentifier(viewControllerIdentifier) as! T
    }

    public func instantiateViewController<T>() -> T {
        return instantiateViewController(String(T.self))
    }
}
--- 
+++ 
@@ -10,22 +10,24 @@
 
 public struct BothamStoryboard {
     private let name: String
+    private let bundle: NSBundle
 
-    public init(name: String) {
+    public init(name: String, bundle: NSBundle = NSBundle.mainBundle()) {
         self.name = name
+        self.bundle = bundle
     }
 
-    private func storyboard(name: String) -> UIStoryboard {
-        return UIStoryboard(name: name, bundle: NSBundle.mainBundle())
+    private func storyboard(name: String, bundle: NSBundle) -> UIStoryboard {
+        return UIStoryboard(name: name, bundle: bundle)
     }
 
     public func initialViewController<T>() -> T {
-        let uiStoryboard = storyboard(name)
+        let uiStoryboard = storyboard(name, bundle: bundle)
         return uiStoryboard.instantiateInitialViewController() as! T
     }
 
     public func instantiateViewController<T>(viewControllerIdentifier: String) -> T {
-        let uiStoryboard = storyboard(name)
+        let uiStoryboard = storyboard(name, bundle: bundle)
         return uiStoryboard.instantiateViewControllerWithIdentifier(viewControllerIdentifier) as! T
     }
 
Add support to indicate the bundle in which the Storyboard should be located
