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

Xcode 8.3+
iOS 8.0+
Swift 3.1+
Carthage compatible
pod

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.0

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

Usage

Reuse Container

Create and set

Same with using table view

let container = ReuseContainer()
container.register(UIImageView.self)
container.register(UIViewController.self)
// container.register(UIView.self, forPageReuseIdentifier: "UIView")
container.dataSource = self

Suggest that set reuseIdentifier with auto. Default is class name.

Implement ReuseContainerDataSource

func numberOfPages() -> Int {
    return 10
}

func container(_ container: ReuseContainer, pageForIndexAt index: Int) -> Page {
    if let page = container.dequeueReusablePage(withIdentifier: UIImageView.reuseIdentifier) as? UIImageView {
        /// do some thing
        return page
    } else if let page = container.dequeueReusablePage(withIdentifier: UIViewController.reuseIdentifier) as? UIViewController {
        /// do some thing
        return page
    } else {
        let view = UIView()
        /// do some thing
        return view
    }
}

Latest podspec

{
    "name": "PageKit",
    "version": "0.2.0",
    "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.0"
    },
    "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