Skip to content

Commit

Permalink
Merge pull request xmartlabs#454 from mlequeux/master
Browse files Browse the repository at this point in the history
Proper Bundle loading when linking with static libraries
  • Loading branch information
Martin Barreto authored Oct 11, 2017
2 parents 30b9e41 + 3dc8377 commit 835570c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Sources/BaseButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,14 @@ open class ExampleBaseButtonBarPagerTabStripViewController: BaseButtonBarPagerTa
}

open func initialize() {
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width: { [weak self] (childItemInfo) -> CGFloat in
var bundle = Bundle(for: ButtonBarViewCell.self)
if let resourcePath = bundle.path(forResource: "XLPagerTabStrip", ofType: "bundle") {
if let resourcesBundle = Bundle(path: resourcePath) {
bundle = resourcesBundle
}
}

buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: bundle, width: { [weak self] (childItemInfo) -> CGFloat in
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.font = self?.settings.style.buttonBarItemFont ?? label.font
Expand Down
10 changes: 9 additions & 1 deletion Sources/ButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,15 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa

open override func viewDidLoad() {
super.viewDidLoad()
buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: Bundle(for: ButtonBarViewCell.self), width: { [weak self] (childItemInfo) -> CGFloat in

var bundle = Bundle(for: ButtonBarViewCell.self)
if let resourcePath = bundle.path(forResource: "XLPagerTabStrip", ofType: "bundle") {
if let resourcesBundle = Bundle(path: resourcePath) {
bundle = resourcesBundle
}
}

buttonBarItemSpec = .nibFile(nibName: "ButtonCell", bundle: bundle, width: { [weak self] (childItemInfo) -> CGFloat in
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
label.font = self?.settings.style.buttonBarItemFont
Expand Down

0 comments on commit 835570c

Please sign in to comment.