Giter VIP home page Giter VIP logo

ezimetyusup / wormtabstrip Goto Github PK

View Code? Open in Web Editor NEW
186.0 12.0 32.0 22.49 MB

πŸ› WormTabStrip ViewPager for iOS written in Swift, which gives continuous feedback to the user when scrolling

License: MIT License

Swift 98.03% Ruby 1.97%
tabstrip swift worm-tab-strip ios smarttabstrip viewpager smarttapstrip swift-viewpager ios-viewpager slider scrollview slidingtablayout slidingtabstrip swipable viewpager-indicator

wormtabstrip's Introduction

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:

  • Bubble style:

alt text

  • Line style:

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

Property Description
wormStyel style of the worm bubble or line
kHeightOfWorm worm height for line style
kHeightOfWormForBubble worm height for bubble style
kHeightOfDivider divider height between top scrollview and conent scrollview
kHeightOfTopScrollView Top scrollView height which hold all tabs
kMinimumWormHeightRatio minimum worm height Ratio, it should be less than 1
kPaddingOfIndicator Padding of tab button, from text to button each side
spacingBetweenTabs space between tab buttons
isWormEnable boolean, if false it will not animate worm
tabItemDefaultFont font for unSelected tab
tabItemSelectedFont font for selected tab
tabItemDefaultColor text color for unSelected tab
tabItemSelectedColor text color for selected tab
WormColor color for worm
topScrollViewBackgroundColor back ground color of top scroll view which hold all tabs
contentScrollViewBackgroundColor back ground color fo content scroll view
dividerBackgroundColor back 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

wormtabstrip's People

Contributors

creatiolabsmx avatar ezimetyusup avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wormtabstrip's Issues

Better Readme

Hey, your library is really interesting.

The only problem I found was the README.md, which lacks information.
I created this iOS Open source Readme Template so you can take a look on how to better organize.
If you want, I can help you to do it.

What are your thoughts?

Crash @ selectTabAt

WormTabStrip.selectTabAt(index: 1)
Crash if try to set index 1 as default from [vc1,vc2]

Center selected tab

Can we center the selected tab like Android version with attribute stl_indicatorAlwaysInCenter ?

Table data didn't show

How to show table data? Because when I try the demo project and set up the data table, the data only show once and after that it disappear

WormTabStrip inaccessible

WormTabStrip initializer is inaccessible due to internal protection level.

Add the public init correctly for pods, use the Libreary manual is better.

Which Tab is Selected

hey
thanks for awesome library.
in my project I need to know which one of tab is selected! how can i do that?

Method to identify the tab click.

In my case, I just have one view controller with table view and I want to reload the table view.

Is there any method to identify the tab click so that I can reload the tableview?

@EzimetYusup

How can i use tableview controller and cell inside App ?

@EzimetYusup Thanks for giving library! i need to populating tableview data.
func WTSviewOfTab(index: Int) -> UIView { let view:LeaveTableVC = LeaveTableVC() if index == 0 { view.view.backgroundColor = UIColor.black }

self.tableview.delegate = self
    self.tableview.dataSource = self,  `

Error: fatal error: unexpectedly found nil while unwrapping an Optional value

I was getting tableview.delegate = self (in leavetableVC class)
Please help me out this issue

Worm Tab Title Size

Please initialize Fount in WormTabStripButton also , because if you don't initialize then font and size will not reflect first time
so i use -> self.font = AppTheme.TabStripFont()
class WormTabStripButton: UILabel{

var index:Int?
var paddingToEachSide:CGFloat = 10
var tabText:NSString?{
    didSet{
        let textSize:CGSize = tabText!.size(withAttributes: [NSAttributedStringKey.font: font])
        self.frame.size.width = textSize.width + paddingToEachSide + paddingToEachSide
        
        self.text = String(tabText!)
    }
}
//MARK: init
override init(frame: CGRect) {
    super.init(frame: frame)
    self.font = AppTheme.TabStripFont()
}
convenience required init(key:String) {
    self.init(frame:CGRect.zero)
    self.font = AppTheme.TabStripFont()
}



required init?(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
    
}

}

Tableview Disappears

Hi, I'm loving WormTabStrip but I ran into a problem when I add in a tableview's view.
The tableview seems to completely disappear whenever I touch it.

My tableview controller works fine when it's not under a tab so I'm not sure what could cause it to disappear under WormTabStrip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.