Latest 1.1.1
Homepage https://github.com/naoto0822/SwipePager
License MIT
Platforms ios 8.0, requires ARC
Authors

Platform
Language
License
Issues

SwipePager is UIPageViewController wrapper like Gunosy, SmartNews UI.

SwipePager

Version

  • current vesion 1.1.1

Requirements

  • iOS8 and up
  • Swift 2.3
  • Xcode 7.x

Installation

using CocoaPods

add the following line to your Podfile:

pod 'SwipePager'

and import

import SwipePager

manual

  • add SwipePager.swift and SwipePagerMenu.swift in Source/ to your project.

Usage

1. protocol declaration

SwipePagerDataSource
SwipePagerDelegate

 class ViewController: UIViewController, SwipePagerDataSource, SwipePagerDelegate

2. SwipePager initialize

initialize and need call reloadData()

 override func viewDidLoad() {
     super.viewDidLoad()

     let swipePager = SwipePager(frame: frame, transitionStyle: .Scroll)
     swipePager.dataSource = self
     swipePager.delegate = self
     self.view.addSubview(swipePager)
     swipePager.reloadData()
 }

3. SwipePagerDataSource Protocol

func sizeForMenu(#swipePager: SwipePager) -> CGSize

 func sizeForMenu(#swipePager: SwipePager) -> CGSize {
     return CGSizeMake(80, 50)
 }

func menuViews(#swipePager: SwipePager) -> [SwipePagerMenu]

 func menuViews(#swipePager: SwipePager) -> [SwipePagerMenu] {
     // use SwipePagerMenu Class
     var array: [SwipePagerMenu] = []

     for var i = 0; i < 8; i++ {
         var menu = SwipePagerMenu()
         // customize color
         menu.stateNormalColor = UIColor.lightGrayColor()
         menu.stateNormalFontColor = UIColor.whiteColor()
         menu.stateHighlightColor = UIColor.blackColor()
         menu.stateHighlightFontColor = UIColor.whiteColor()
         // label title
         if i == 0 { menu.title = "0" }
         if i == 1 { menu.title = "1" }
         if i == 2 { menu.title = "2" }
         array.append(menu)
     }

     return array
 }

func viewControllers(#swipePager: SwipePager) -> [UIViewController]

 func viewControllers(#swipePager: SwipePager) -> [UIViewController] {
     var array: [UIViewController] = []

     for var i = 0; i < 8; i++ {
         let viewController = UIViewController()
         // viewController setting...
         array.append(viewController)
     }

     return array
 }

4. SwipePagerDelegate Protocol

 func swipePager(#swipePager: SwipePager, didMoveToPage page: Int) {
        println("move to :" + page.description)
 }

SwipePagerMenu Class

property

title: menu title.

font: menu font.

stateNormalColor: state normal menu color.

stateNormalFontColor: state normal font color.

stateHighlightColor: state highlight menu color.

stateHighlightFontColor: state highlight font color.

Option

currentPage

can setting start page.
SwipePager Class property. (default 0)

swipePager.currentPage = 2

swipeEnabled

disEnabled swipe gesture.
SwipePager Class property. (default true)

swipePager.swipeEnabled = false

License

The MIT License (MIT)

Copyright (c) 2015 naoto yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Latest podspec

{
    "name": "SwipePager",
    "version": "1.1.1",
    "summary": "SwipePager is UIPageViewController wrapper like Gunosy, SmartNews UI.",
    "homepage": "https://github.com/naoto0822/SwipePager",
    "license": "MIT",
    "authors": {
        "naoto0822": "[email protected]"
    },
    "source": {
        "git": "https://github.com/naoto0822/SwipePager.git",
        "tag": "1.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Source/*.{swift}",
    "pushed_with_swift_version": "2.3"
}

Pin It on Pinterest

Share This