Latest 0.1.1
Homepage https://github.com/pikachu987/PKCSwipeReusableView
License MIT
Platforms ios 8.0
Authors

CI Status
Version
License
Platform

Example

image
image

To run the example project, clone the repo, and run pod install from the Example directory first.


import PKCSwipeReusableView

class ReusableView: PKCSwipeReusableView{ }

class ViewController: UIViewController{

    override func viewDidLoad(){
        self.collectionView.register(ReusableView.self, forSupplementaryViewOfKind: UICollectionElementKindSectionHeader, withReuseIdentifier: "ReusableView")
        self.collectionView.dataSource = self
    }

    func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
        if kind == UICollectionElementKindSectionHeader{
            let reusableView = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "ReusableView", for: indexPath) as! ReusableView

            reusableView.label.text = "ReusableView Header"
            let pkcButton1 = PKCButton(frame: .zero)
            pkcButton1.backgroundColor = .red
            pkcButton1.setTitle("Delete", for: .normal)
            reusableView.addRightSwipe(pkcButton1)
            pkcButton1.addTarget({ (button) in
                print(button)
            })
            if indexPath.section < 3{
                let pkcButton2 = PKCButton(frame: .zero)
                pkcButton2.backgroundColor = .green
                pkcButton2.setTitle("Save", for: .normal)
                reusableView.addLeftSwipe(pkcButton2)
            }
            return reusableView
        }else{
            assert(false, "Unexpected element kind")
        }
    }

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
        return CGSize(width: UIScreen.main.bounds.width, height: 50)
    }

}

Installation

PKCSwipeReusableView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "PKCSwipeReusableView"

Author

pikachu987, [email protected]

License

PKCSwipeReusableView is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PKCSwipeReusableView",
    "version": "0.1.1",
    "summary": "ReusableView Swipe Button",
    "description": "ReusableView Left, Right Swipe Button",
    "homepage": "https://github.com/pikachu987/PKCSwipeReusableView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "pikachu987": "[email protected]"
    },
    "source": {
        "git": "https://github.com/pikachu987/PKCSwipeReusableView.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "PKCSwipeReusableView/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This