I am trying to make CocoaPod, which includes .xibfor two full days, but to no avail. I have a standalone Xcode project for my framework with the following .podspec:
Pod::Spec.new do |s|
s.name = "OrderStatusTable"
s.version = "1.2.0"
s.platform = :ios
s.ios.deployment_target = '9.0'
s.summary = "Order Status UITableView framework."
s.description = "A UITableView framework with custom view."
s.homepage = "https://github.com/myname/OrderStatusTableView"
s.license = { :type => "MIT", :file => "LICENSE" }
s.author = { "My Name" => "My Email" }
s.platform = :ios, "9.0"
s.source = { :git => "https://github.com/myname/OrderStatusTableView.git", :tag => "1.2.0" }
s.source_files = "OrderStatusTable/**/*.{h,m,swift}"
s.resource_bundles = {
'OrderStatusTable' => [
'Pod/**/*.xib'
]
}
end
In my sample project, I am adding pod 'OrderStatusTable', :git => 'https://github.com/myname/OrderStatusTableView.git', :tag => ‘1.2.0’to my subfile. My file is .xibincluded in the Resources folder inside the module in the sample project, but I keep getting this error:fatal error: Could not create a path to the bundle: file /Users/myname/Desktop/appname/OrderStatusTableDemo/Pods/OrderStatusTable/OrderStatusTable/OrderStatusTable.swift, line 40
This is a UITableViewframework, and I am trying to register a custom UITableViewCellnib with a cell reuse identifier, for example:
public class OrderStatusTable: UITableView {
public override func awakeFromNib() {
delegate = self
dataSource = self
let podBundle = NSBundle(forClass: self.classForCoder)
if let bundleURL = podBundle.URLForResource("OrderStatusTable", withExtension: "bundle") {
if let bundle = NSBundle(URL: bundleURL) {
let cellNib = UINib(nibName: "OrderStatusTableViewCell", bundle: bundle)
registerNib(cellNib, forCellReuseIdentifier: "OrderStatusTableViewCell")
} else {
assertionFailure("Could not load the bundle")
}
} else {
assertionFailure("Could not create a path to the bundle")
}
}
So I'm not sure if I have the wrong package URLForResourceor what? This is not well documented on the Internet. Can someone please advise? Thank!