Latest 0.2.1
Homepage https://github.com/XWJACK/PageKit
License MIT
Platforms ios 8.0, requires ARC
Authors

Xcode 8.3+
iOS 8.0+
Swift 3.0+
Carthage compatible
Version

Overview

Easy way to use UIScrollView page

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects.

Specify PageKit into your project’s Podfile:

platform :ios, '8.0'
use_frameworks!

target '<Your App Target>' do
  pod 'PageKit', :git => '[email protected]:XWJACK/PageKit.git'
end

Then run the following command:

$ pod install

Carthage

Carthage is a simple, decentralized
dependency manager for Cocoa.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate PageKit into your Xcode project using Carthage, specify it in your Cartfile:

github "XWJACK/PageKit" ~> 0.2.1

Run carthage update to build the framework and drag the built PageKit.framework into your Xcode project.

Usage

ReuseContainer

GuidePage: ReuseContainer

Using same with UITableView.

class GuidePageViewController: UIViewController, GuidePageDatasource {

    let guidePage = GuidePage()

    override func viewDidLoad() {
        super.viewDidLoad()

        guidePage.dataSource = self
        guidePage.register(TestPageImageView.self)
        guidePage.register(TestPageViewController.self)

        view.addSubview(guidePage)
        guidePage.snp.makeConstraints { (make) in
            make.edges.equalToSuperview()
        }
    }
    func numberOfPages() -> Int {
        return 5
    }

    func guidePage(_ guidePage: GuidePage, pageForIndexAt index: Int) -> Page {
        if index % 2 == 0, let page = guidePage.dequeueReusablePage(withIdentifier: TestPageImageView.reuseIdentifier) as? UIImageView {
            page.image = #imageLiteral(resourceName: "origin_background0")
            return page
        } else if let page = guidePage.dequeueReusablePage(withIdentifier: TestPageViewController.reuseIdentifier) as? TestPageViewController {
            return page
        } else {
            let view = UIImageView()
            view.backgroundColor = .red
            return view
        }
    }
}

Latest podspec

{
    "name": "PageKit",
    "version": "0.2.1",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "summary": "Page Library",
    "homepage": "https://github.com/XWJACK/PageKit",
    "authors": {
        "Jack": "[email protected]"
    },
    "source": {
        "git": "https://github.com/XWJACK/PageKit.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": [
        "Sources/*.swift",
        "Sources/PageKit.h"
    ],
    "public_header_files": [
        "Sources/PageKit.h"
    ],
    "requires_arc": true,
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This