Latest 0.3
Homepage https://github.com/MatteoBatti/Pager
License MIT
Platforms ios 9.0
Authors

Pager

UIPagerViewController wrapper

Requirements

  • iOS 9.0+
  • Xcode 9.2

Installation

CocoaPods

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


platform :ios, '9.0'
use_frameworks!

target 'YourTarget' do
    pod "PagerTab"
end

To get the full benefits import PagerTab

import PagerTab

Usage example

set up your PagerTabAppearance

let appearence = PagerTabAppearance(   type: PagerTabType.fixedNumber(2),
                                    titleColors: [(.blue, .selected), (.blue, .highlighted), (.lightGray, .normal)] )

for the different customization options take a look at PagerTabAppearance init

public init(type: PagerTabType,
            selected: Int = 0,
            height: CGFloat = 50.0,
            color: UIColor? = .clear,
            titleColors: [(UIColor, UIControlState)]? = [(.black, .normal)],
            font: UIFont = UIFont.systemFont(ofSize: UIFont.systemFontSize) ) {
            ...

define your viewControllers


let PoutingVC: BeautifulViewController = {  let vc = BeautifulViewController(text: "😡")
                                            vc.view.backgroundColor = UIColor.gray
                                            return vc
                                            }()
let BombVC: BeautifulViewController    = { let vc = BeautifulViewController(text: "💣")
                                            vc.view.backgroundColor = UIColor.lightGray
                                            return vc
                                            }()
let NerdVC: BeautifulViewController    = {  let vc = BeautifulViewController(text: "🤓")
                                            vc.view.backgroundColor = UIColor.white
                                            return vc
                                            }()
let SkullVC: BeautifulViewController   = {  let vc = BeautifulViewController(text: "☠️")
                                            vc.view.backgroundColor = UIColor.green
                                            return vc
                                            }()

set up the PagerTabPage array

let viewControllers: [PagerTabPage] = [( PoutingVC , "Pouting"),
                                    ( BombVC , "Bomb"),
                                    ( NerdVC , "Nerd"),
                                    ( SkullVC , "Skull") ]

init your PagerTab

let pager = PagerTab( viewControllers , appearence:  appearence )

add it to your view

self.add(childController: pager, toView: self.view)

Example Preview

PagerTab

Latest podspec

{
    "name": "PagerTab",
    "version": "0.3",
    "summary": "Elegant Pager View in Swift",
    "license": "MIT",
    "homepage": "https://github.com/MatteoBatti/Pager",
    "authors": {
        "Matteo Battistini": "[email protected]"
    },
    "source": {
        "git": "https://github.com/MatteoBatti/Pager.git",
        "tag": "0.3"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "Sources/**/*"
}

Pin It on Pinterest

Share This