Skip to content

Commit 835570c

Browse files
author
Martin Barreto
authored
Merge pull request xmartlabs#454 from mlequeux/master
Proper Bundle loading when linking with static libraries
2 parents 30b9e41 + 3dc8377 commit 835570c

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Sources/BaseButtonBarPagerTabStripViewController.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,14 @@ open class ExampleBaseButtonBarPagerTabStripViewController: BaseButtonBarPagerTa
321321
}
322322

323323
open func initialize() {
324-
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width: { [weak self] (childItemInfo) -> CGFloat in
324+
var bundle = Bundle(for: ButtonBarViewCell.self)
325+
if let resourcePath = bundle.path(forResource: "XLPagerTabStrip", ofType: "bundle") {
326+
if let resourcesBundle = Bundle(path: resourcePath) {
327+
bundle = resourcesBundle
328+
}
329+
}
330+
331+
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: bundle, width: { [weak self] (childItemInfo) -> CGFloat in
325332
let label = UILabel()
326333
label.translatesAutoresizingMaskIntoConstraints = false
327334
label.font = self?.settings.style.buttonBarItemFont ?? label.font

Sources/ButtonBarPagerTabStripViewController.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,15 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
101101

102102
open override func viewDidLoad() {
103103
super.viewDidLoad()
104-
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width: { [weak self] (childItemInfo) -> CGFloat in
104+
105+
var bundle = Bundle(for: ButtonBarViewCell.self)
106+
if let resourcePath = bundle.path(forResource: "XLPagerTabStrip", ofType: "bundle") {
107+
if let resourcesBundle = Bundle(path: resourcePath) {
108+
bundle = resourcesBundle
109+
}
110+
}
111+
112+
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: bundle, width: { [weak self] (childItemInfo) -> CGFloat in
105113
let label = UILabel()
106114
label.translatesAutoresizingMaskIntoConstraints = false
107115
label.font = self?.settings.style.buttonBarItemFont

0 commit comments

Comments
 (0)