Xlpagertabstrip: Update to Swift 4

Created on 21 Sep 2017  路  25Comments  路  Source: xmartlabs/XLPagerTabStrip

Before submitting issues ...

  • Make sure you are using XLPagerTabStrip latest release or master branch version.
  • Make sure your Xcode version is the latest stable one.
  • Check if the issue was already reported or fixed. We add labels to each issue in order to easily find related issues. If you found a match add a brief comment "I have the same problem" or "+1".
  • Please do not use the issue tracker for personal support requests. Stack Overflow is a better place for that where a wider community can help you!

When submitting issues, please provide the following information to help maintainers to fix the problem faster:

  • Environment: XLPagerTabStrip, Xcode and iOS version you are using.
  • In case of reporting errors, provide Xcode console output of stack trace or code compilation error.
  • Any other additional detail such as example code that you think it would be useful to understand, reproduce and solve the problem.

Most helpful comment

Open ButtonBarPagerTabStripViewController.swift file.
In ButtonBarPagerTabStripViewController class, remove UICollectionViewDelegate protocol and implement UICollectionViewDelegateFlowLayout protocol.

All 25 comments

Please update to swift 4.
I got some warnings converting my project from swift 3.1 to swift 4

Ok now it has some bugs
the tab bar of XLPager is black and the labels positions has modified in Swift 4
and ruined everything
please fix it as soon as possible

it's image:

photo_2017-09-21_22-19-38

+1

+1

+1

+1

Open ButtonBarPagerTabStripViewController.swift file.
In ButtonBarPagerTabStripViewController class, remove UICollectionViewDelegate protocol and implement UICollectionViewDelegateFlowLayout protocol.

@allen-rahman solution works great!
Thank u man

Welcome

unadjustednonraw_thumb_30

@allen-rahman same problem :(

+1

+1

+1
I'm using xib and faced with the same issue.

@ahmedsafadii May I test with your partial codes?

@allen-rahman what exactly do you want see ?

code which makes the screen with storyboard.

func pageMenuStyle(){

    settings.style.buttonBarBackgroundColor = UIColor("294548")
    settings.style.buttonBarItemBackgroundColor = UIColor("294548")
    settings.style.selectedBarBackgroundColor = UIColor.white
    settings.style.buttonBarItemFont = UIFont(name: "OpenSans", size: 15)!
    settings.style.selectedBarHeight = 2
    settings.style.buttonBarMinimumLineSpacing = 0
    settings.style.buttonBarItemTitleColor = .white
    settings.style.buttonBarItemsShouldFillAvailableWidth = true
    settings.style.buttonBarLeftContentInset = 0
    settings.style.buttonBarRightContentInset = 0


    changeCurrentIndexProgressive = { (oldCell: ButtonBarViewCell?, newCell: ButtonBarViewCell?, progressPercentage: CGFloat, changeCurrentIndex: Bool, animated: Bool) -> Void in
        guard changeCurrentIndex == true else { return }
        oldCell?.label.textColor = UIColor.gray
        newCell?.label.textColor = UIColor.white
    }

}

}

@allen-rahman

First question, did you call settings.style change before super.viewDidLoad()?
You should call settings.style.* before super.viewDidLoad()
And What's your XCode version?

yeah i did and the xcode version is 9

After your super.viewDidLoad(), add this:

        buttonBarItemSpec = ButtonBarItemSpec.cellClass(width: { _ -> CGFloat in
            return 150  // <-- Your desired width
        })

strange it works now like charm don't know what happened i just remove the library from the pod and install it again and it works :/

Happy to hear that.

Hello, i have implemented XLPagerTabStrip in Swift 4 but childView don't show contentView. Any one know what is the issue.

After your super.viewDidLoad(), add this:

        buttonBarItemSpec = ButtonBarItemSpec.cellClass(width: { _ -> CGFloat in
            return 150  // <-- Your desired width
        })

Thank solution works

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrewabdalla picture andrewabdalla  路  6Comments

unittesting0 picture unittesting0  路  3Comments

bishalg picture bishalg  路  5Comments

emrecanozturk picture emrecanozturk  路  5Comments

Ta7an picture Ta7an  路  4Comments