SWIFT - 从 Objective-C 实例化故事板

SWIFT - Storyboard instantiating from Objective-C

我正在将一个用 Objective-C 制作的旧应用程序翻译成新的 SWIFT 2.0 语言,但我在这行特定的代码中遇到了一些困难:

UIStoryboard *sdkStoryboard = [UIStoryboard storyboardWithName:@"MyStoryboard" bundle:[NSBundle bundleWithIdentifier:@"thirdParty.MySDK"]];

问题出在 "bundle" 部分,我做了很多研究,但其中 none 可以解决问题,因为找到的大多数示例都是 "bundle: nil"

这是我现在能做的:

let sdkStoryboard: UIStoryboard = UIStoryboard(name: "MyStoryboard", bundle: ???)

谢谢!

试试这个:

let Bundlepath = NSBundle(identifier: "thirdParty.MySDK")
let sdkStoryboard: UIStoryboard = UIStoryboard(name: "MyStoryboard", bundle: Bundlepath )

此致!

怎么样:

UIStoryboard(name: "MyStoryboard", bundle: NSBundle(identifier: "thirdParty.MySDK"))
let storyboard = UIStoryboard(name: "MyStoryboard", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("thirdParty.MySDK") as! UIViewController
self.presentViewController(vc, animated: true, completion: nil)