I'm trying to modularize a large iOS project (being developed in Swift) using cocoa pods. The idea is to create "sub apps" complete with storyboards and assets which could be integrated into the main project.
I'm having troubles using storyboards in such a scenario. The issue is similar to (I think): https://github.com/CocoaPods/CocoaPods/issues/2597
Here is the .podspec of the module I'm trying to convert into a pod:
Pod::Spec.new do |spec|
spec.name = 'GlycoAppMenuModule'
spec.version = '0.0.8'
spec.license = { :type => 'MIT', :file => 'LICENSE' }
spec.homepage = 'https://google.com'
spec.platform = :ios, "8.0"
spec.authors = { 'Abdulla Contractor' => 'abdulla.contractor@gmail.com' }
spec.summary = 'Views for menu page'
spec.source = { :git => 'https://github.com/Holmusk/GlycoAppMenuModule.git', :tag => '0.0.8' }
spec.source_files = 'GlycoAppMenuModule/*'
spec.resource_bundles = {
'resources' => ['GlycoAppMenuModule/**/*.{lproj,storyboard}']}
# spec.framework = 'Foundation'
end
and here is the code I use to attempt to use the storyboard
let bundlePath = NSBundle(forClass: GANavigationMenuViewController.self).pathForResource("resources", ofType: "bundle")
let bundle = NSBundle(path: bundlePath!)
let storyboard: UIStoryboard = UIStoryboard(name: "Menu", bundle: bundle)
let vc = storyboard.instantiateInitialViewController() as! UIViewController
self.presentViewController(vc, animated: false, completion: nil)
this is the error I get
2015-06-05 11:39:40.365 temp[3593:50802] Unknown class _TtC9resources30GANavigationMenuViewController in Interface Builder file.
2015-06-05 11:39:40.370 temp[3593:50802] Could not load the "icAccount.png" image referenced from a nib in the bundle with identifier "(null)"
2015-06-05 11:39:40.371 temp[3593:50802] Could not load the "icConnect.png" image referenced from a nib in the bundle with identifier "(null)"
2015-06-05 11:39:40.371 temp[3593:50802] Could not load the "icDiabetesProfile.png" image referenced from a nib in the bundle with identifier "(null)"
2015-06-05 11:39:40.373 temp[3593:50802] Could not load the "icLogout.png" image referenced from a nib in the bundle with identifier "(null)"
2015-06-05 11:39:40.377 temp[3593:50802] Could not load the "icCircle.png" image referenced from a nib in the bundle with identifier "(null)"
2015-06-05 11:39:40.386 temp[3593:50802] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIViewController 0x7fb3f3d2cdd0> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key accountButton.'
Any idea what I may be missing?