Latest 1.1
Homepage https://github.com/AppsComTr/APFancyPager
License MIT
Platforms ios 8.0
Authors

A fancy pager view controller framework for Swift/Objective-C

Platform
CocoaPods
Carthage compatible
License

Installation

Cocoapods

Simply add the APFancyPager to your Podfile:

pod 'APFancyPager'

Carthage

You can use Carthage as well. Paste below line to your Cartfile:
github "AppsComTr/APFancyPager"

Manual

Also, you can copy-paste the Swift files directly into your project.

Usage

You can check the demo project to get the basics of the framework.

Simply make your view controller extend APFancyPagerViewController and also implement the data source and optionally the delegate.

You should use the below data source function in order to specify the number of pages that APFancyPager will show.

func numberOfViewControllers(in fancyPagerViewController: APFancyPagerViewController) -> Int {
        return pages.count
}

Also you should return your desired header height from the data source function below.

func heightForHeader(_ fancyPagerViewController: APFancyPagerViewController) -> CGFloat {
        return 100.0
}

You should return related view controller into pages by using fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, viewControllerForIndex index: Int) -> UIViewController
Just return your view controller for related index.

You want to show header titles for your fancy pager, don’t you? Here, use below data source function o achieve this:

func fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, headerStringForIndex index: Int) -> String

For the text color of the header at index this:

func fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, headerTextColorForIndex index: Int) -> UIColor

and for the background color at index, this:

func fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, headerBackgroundColorForIndex index: Int) -> UIColor

There are 2 delegate functions which are func fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, didScrollToIndex index: Int) and func fancyPagerViewController(_ fancyPagerViewController: APFancyPagerViewController, isScrollingFromIndex fromIndex: Int, toIndex: Int, progress: CGFloat). You can use them to get some useful (maybe not useful that much) informations about the APFancyPager.

The last but not least, you can use an extra function to scroll the APFancyPager to the any index directly. To achieve this, simply use below function:

func scrollToPage(_ pageNumber: Int, animated: Bool)

Preview

APFancyPager

License

APFancyPager is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "APFancyPager",
    "version": "1.1",
    "summary": "A fancy pager view controller framework for Swift/Objective-C",
    "description": "A fancy pager view controller framework for Swift/Objective-C",
    "homepage": "https://github.com/AppsComTr/APFancyPager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Orhun Mert Simsek": "[email protected]"
    },
    "social_media_url": "http://twitter.com/orhunmertsimsek",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/AppsComTr/APFancyPager.git",
        "tag": "1.1"
    },
    "source_files": "APFancyPager/**/*.{h,m,swift}",
    "swift_version": "4.2",
    "documentation_url": "http://apps.com.tr/APFancyPager/docs/"
}

Pin It on Pinterest

Share This