All Projects → YuigaWada → Poliopager

YuigaWada / Poliopager

Licence: mit
A flexible TabBarController with search tab like SNKRS.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Poliopager

Ioniconskit
Use Ionicons in your Swift projects.
Stars: ✭ 310 (+133.08%)
Mutual labels:  cocoapods, carthage, ios-ui
Xlactioncontroller
Fully customizable and extensible action sheet controller written in Swift
Stars: ✭ 3,228 (+2327.07%)
Mutual labels:  cocoapods, carthage, ios-ui
Eureka
Elegant iOS form builder in Swift
Stars: ✭ 11,345 (+8430.08%)
Mutual labels:  cocoapods, carthage, ios-ui
Tbactionsheet
A Custom&Powerful Action Sheet For iOS. 一个 ActionSheet 满足所有样式!超高自由度的可定制!
Stars: ✭ 942 (+608.27%)
Mutual labels:  cocoapods, carthage, ios-ui
Xlpagertabstrip
Android PagerTabStrip for iOS.
Stars: ✭ 6,671 (+4915.79%)
Mutual labels:  cocoapods, carthage, ios-ui
Foldingtabbar.ios
Folding Tab Bar and Tab Bar Controller
Stars: ✭ 3,677 (+2664.66%)
Mutual labels:  cocoapods, carthage, tabbar
Swiftpagemenu
Customizable Page Tab Menu Controller 👍
Stars: ✭ 233 (+75.19%)
Mutual labels:  cocoapods, carthage, ios-ui
Swiftoverlays
SwiftOverlays is a Swift GUI library for displaying various popups and notifications
Stars: ✭ 621 (+366.92%)
Mutual labels:  cocoapods, carthage, ios-ui
Cascadingtabledelegate
A no-nonsense way to write cleaner UITableViewDelegate and UITableViewDataSource in Swift.
Stars: ✭ 931 (+600%)
Mutual labels:  cocoapods, carthage, ios-ui
Nvactivityindicatorview
A collection of awesome loading animations
Stars: ✭ 10,031 (+7442.11%)
Mutual labels:  cocoapods, carthage, ios-ui
Shari
Shari is the alternative to the library of UIPickerView(drum roll) in Swift. You can select a item using UITableView.
Stars: ✭ 111 (-16.54%)
Mutual labels:  cocoapods, carthage
Device
Light weight tool for detecting the current device and screen size written in swift.
Stars: ✭ 1,503 (+1030.08%)
Mutual labels:  cocoapods, carthage
Randomkit
Random data generation in Swift
Stars: ✭ 1,458 (+996.24%)
Mutual labels:  cocoapods, carthage
Szmentionsswift
Library to help handle mentions
Stars: ✭ 109 (-18.05%)
Mutual labels:  cocoapods, carthage
Fontawesome.swift
Use FontAwesome in your Swift projects
Stars: ✭ 1,513 (+1037.59%)
Mutual labels:  cocoapods, carthage
Microfeatures Example
📦📱 Example of iOS app built using the uFeatures architecture
Stars: ✭ 112 (-15.79%)
Mutual labels:  cocoapods, carthage
Natrium
A pre-build (Swift) script to alter your Xcode project at pre-build-time per environment, build configuration and target.
Stars: ✭ 131 (-1.5%)
Mutual labels:  cocoapods, carthage
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-11.28%)
Mutual labels:  cocoapods, carthage
Sqift
Powerful Swift wrapper for SQLite
Stars: ✭ 119 (-10.53%)
Mutual labels:  cocoapods, carthage
Pincodeinputview
A input text view for entering pin code.
Stars: ✭ 108 (-18.8%)
Mutual labels:  cocoapods, carthage

PolioPager

License Swift Version CocoaPods Compatible Carthage compatible


PolioPager is the easiest way to use PagerTabStrip including search tab in iOS. Written in pure swift.

(日本語はこちら)



Comparison

SNKRS



↓↓↓↓

PoiloPager

PolioPager enables us to use PagerTabStrip like SNKRS.

Installation

CocoaPods

You can use CocoaPods to install PolioPager by adding it to your Podfile:

pod 'PolioPager'

To get the full benefits, import PolioPager

import PolioPager

Carthage

Create a Cartfile that lists the framework and run carthage update. Follow the instructions to add $(SRCROOT)/Carthage/Build/iOS/PolioPager.framework to an iOS project.

github "YuigaWada/PolioPager"

Swift Package Manager

Open Xcode and Select from menu to File > Swift Packages > Add Package Depende.

Manually

  1. Download and drop PolioPager in your project.
  2. Congratulations!



Usage example

import PolioPager

class ViewController: PolioPagerViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func tabItems()-> [TabItem] {
        return [TabItem(title: "Redbull"),TabItem(title: "Monster"),TabItem(title: "Caffeine Addiction")]
    }

    override func viewControllers()-> [UIViewController]
    {
        let storyboard = UIStoryboard(name: "Main", bundle: nil)

        let viewController1 = storyboard.instantiateViewController(withIdentifier: "searchView")
        let viewController2 = storyboard.instantiateViewController(withIdentifier: "view1")
        let viewController3 = storyboard.instantiateViewController(withIdentifier: "view2")
        let viewController4 = storyboard.instantiateViewController(withIdentifier: "view3")

        return [viewController1, viewController2, viewController3, viewController4]
    }
}



Usage

PolioPager is very simple.

First, you have to create a view controller that extends PolioPagerViewController

class ViewController: PolioPagerViewController {
    ...
}



You need at least tabItems() and viewControllers().

Tab Items

You only have to prepare TabItem Structure and override tabItems() .

Widths of each tab are automatically calculated.

override func tabItems()-> [TabItem] {
    return [TabItem(title: "Redbull"),TabItem(title: "Monster"),TabItem(title: "Caffeine Addiction")]
}

ViewControllers

Override viewControllers() .

override func viewControllers()-> [UIViewController]
{
    let storyboard = UIStoryboard(name: "Main", bundle: nil)

    let viewController1 = storyboard.instantiateViewController(withIdentifier: "searchView")
    let viewController2 = storyboard.instantiateViewController(withIdentifier: "view1")

    return [viewController1, viewController2]
}

In the above example, ViewControllers are prepared from storyboard.

For those who don't know instantiateViewController , check below.







TabItem structure

TabItem is defined as follow.

public struct TabItem {
    var title: String?
    var image: UIImage?
    var font: UIFont
    var cellWidth: CGFloat?
    var backgroundColor: UIColor
    var normalColor:UIColor
    var highlightedColor: UIColor

    public init(title: String? = nil,
    image: UIImage? = nil,
    font:UIFont = .systemFont(ofSize: 15),
    cellWidth: CGFloat? = nil,
    backgroundColor: UIColor = .white,
    normalColor: UIColor = .lightGray,
    highlightedColor: UIColor = .black){

        self.title = title
        self.image = image
        self.font = font
        self.cellWidth = cellWidth
        self.backgroundColor = backgroundColor
        self.normalColor = normalColor
        self.highlightedColor = highlightedColor

    }
}

Search ViewController

To get input on TextFiled in Search ViewController, you have to adopt PolioPagerSearchTabDelegate protocol.

For example,

import PolioPager

class SearchViewController: UIViewController, PolioPagerSearchTabDelegate, UITextFieldDelegate {

    @IBOutlet weak var label: UILabel!


    var searchBar: UIView!
    var searchTextField: UITextField!
    var cancelButton: UIButton!


    override func viewDidLoad() {
        super.viewDidLoad()

        self.searchTextField.delegate = self
    }

    func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
        guard let text = textField.text else{ return true }

        label.text = text
        return true
    }


}



Customization

Color & Frame & Duration

Check this.

//color
public var tabBackgroundColor: UIColor = .white

//duration
public var barAnimationDuration: Double = 0.23
public var eachLineSpacing: CGFloat = 5
public var sectionInset: UIEdgeInsets = UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 10)

public var selectedBarHeight: CGFloat = 3



//selectedBar
public var selectedBarMargins: (upper: CGFloat, lower: CGFloat) = (1, 2)

//pageView
public var pageViewMargin: CGFloat = 1



Border

You can draw the border between Tab and pageView.

public var needBorder: Bool
public var boderHeight: CGFloat = 1
public var borderColor: UIColor = .lightGray



Duration

public var barAnimationDuration: Double = 0.23 //Default.
public var barAnimationDuration: Double = 0.10



Others

You can also get these Components!

//MARK: open IBOutlet
@IBOutlet weak open var collectionView: UICollectionView!
@IBOutlet weak open var searchBar: UIView!
@IBOutlet weak open var selectedBar: UIView!
@IBOutlet weak open var pageView: UIView!
@IBOutlet weak open var searchTextField: UITextField!
@IBOutlet weak open var cancelButton: UIButton!

For Example, if you want to change the appearance of selectedBar,

//PolioPagerViewController

override func viewDidLoad() {
     self.selectedBarHeight = 2
     self.selectedBar.layer.cornerRadius = 0
     self.selectedBar.backgroundColor = .gray

     super.viewDidLoad()
 }



More

If you want to change the visible child view controller, use moveTo(index: Int)

//PolioPagerViewController

moveTo(index: 1)
moveTo(index: nextIndex)
...

You can set initial index.

class ViewController: PolioPagerViewController {

    override func viewDidLoad() {
        self.initialIndex = 1
        ...
    }
}

Todo

  • [ ] highlightedColorがうまく機能しない
  • [x] Carthageの準備
  • [ ] selectedBarのwidthを割合指定可能に
  • [x] 日本語版READMEの作成

Contribute

We would love you for the contribution to PolioPager, check the LICENSE file for more info.

Others

Yuiga Wada - WebSite Twitter - @YuigaWada

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

https://github.com/YuigaWada/PolioPager

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].