File tree 1 file changed +13
-3
lines changed 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,19 @@ import WebKit
12
12
class AdaWebHostViewController : UIViewController {
13
13
static func createWebController( with webView: WKWebView ) -> AdaWebHostViewController {
14
14
let bundle = Bundle ( for: AdaWebHostViewController . self)
15
- let frameworkBundlePath = bundle. path ( forResource: " AdaEmbedFramework " , ofType: " bundle " ) !
16
- let frameworkBundle = Bundle ( path: frameworkBundlePath)
17
- let storyboard = UIStoryboard ( name: " AdaWebHostViewController " , bundle: frameworkBundle)
15
+
16
+ var storyboard : UIStoryboard
17
+
18
+ // Loads the resource_bundle if available (Cocoapod)
19
+ if ( bundle. path ( forResource: " AdaEmbedFramework " , ofType: " bundle " ) != nil ) {
20
+ let frameworkBundlePath = bundle. path ( forResource: " AdaEmbedFramework " , ofType: " bundle " ) !
21
+ let frameworkBundle = Bundle ( path: frameworkBundlePath)
22
+ storyboard = UIStoryboard ( name: " AdaWebHostViewController " , bundle: frameworkBundle)
23
+ } else {
24
+ // Used for if SDK was manually imported
25
+ storyboard = UIStoryboard ( name: " AdaWebHostViewController " , bundle: bundle)
26
+ }
27
+
18
28
guard let viewController = storyboard. instantiateInitialViewController ( ) as? AdaWebHostViewController else { fatalError ( " This should never, ever happen. " ) }
19
29
viewController. webView = webView
20
30
return viewController
You can’t perform that action at this time.
0 commit comments