Home

Awesome

Worm Tab Strip

Worm Tab Strip is inspired by android SmartTabStrip, android view pager like library for iOS written in swift.

Basically it was build up by two scroll view, one at the top for holding all the tabs, one for content view for each tab. frame based, not auto layout constraint based.

Swift Version Swift Version License Platform

there are two styles of worm tab strip:

alt text

alt text

Current example build environment

XCode 11.4

Swift 5

Installation

CocoaPods

pod 'WormTabStrip', '~> 1.0'

Manually

  1. Download and drop WormTabStrip.swift and WormTabStripButton.swift in your project.
  2. Congratulations!

Looking for swift 2.3?

checkout brach swift2.3

Usage example

implement the WormTabStripDelegate in your UIViewController then do

let frame =  CGRect(x: 0, y: 40, width: self.view.frame.size.width, height: self.view.frame.size.height - 40)
let viewPager:WormTabStrip = WormTabStrip(frame: frame)
self.view.addSubview(viewPager) //IMPORTANT!
viewPager.delegate = self
viewPager.eyStyle.wormStyel = .bubble
viewPager.eyStyle.isWormEnable = true
viewPager.eyStyle.spacingBetweenTabs = 15
viewPager.eyStyle.dividerBackgroundColor = .red
viewPager.eyStyle.tabItemSelectedColor = .yellow
//default selected tab
viewPager.currentTabIndex = 3
//center the selected tab
viewPager.shouldCenterSelectedWorm = true
viewPager.buildUI()

Need custom style?

checkout WormTabStripStylePropertyies struct, give your custom style

viewPager.eyStyle.wormStyel = .line
viewPager.eyStyle.isWormEnable = false
viewPager.eyStyle.spacingBetweenTabs = 15
viewPager.eyStyle.dividerBackgroundColor = .red
viewPager.eyStyle.tabItemSelectedColor = .yellow
...

before you you call

viewPager.buildUI() 

Available customization properties

PropertyDescription
wormStyelstyle of the worm bubble or line
kHeightOfWormworm height for line style
kHeightOfWormForBubbleworm height for bubble style
kHeightOfDividerdivider height between top scrollview and conent scrollview
kHeightOfTopScrollViewTop scrollView height which hold all tabs
kMinimumWormHeightRatiominimum worm height Ratio, it should be less than 1
kPaddingOfIndicatorPadding of tab button, from text to button each side
spacingBetweenTabsspace between tab buttons
isWormEnableboolean, if false it will not animate worm
tabItemDefaultFontfont for unSelected tab
tabItemSelectedFontfont for selected tab
tabItemDefaultColortext color for unSelected tab
tabItemSelectedColortext color for selected tab
WormColorcolor for worm
topScrollViewBackgroundColorback ground color of top scroll view which hold all tabs
contentScrollViewBackgroundColorback ground color fo content scroll view
dividerBackgroundColorback ground color of divider view between top scroll view and content scroll view

Apps using worm tab strip:

Bagdax News, screen shots:

alt text

Contribute

We would love for you to contribute to WormTabStrip, check the LICENSE file for more info.

Meta

Ezimet Yusup – Github

Distributed under the MIT license. See LICENSE for more information.

Stats

Alt