Latest 0.0.2
Homepage https://github.com/MaximKotliar/Parallaxable
License MIT
Platforms ios 9.0
Authors

Version
License
Platform

Beautiful parallax effect for your Table/Collection cells. (Or something else)

Installation

Add

pod 'Parallaxable'

to your podfile, and run

pod install

Usage

Out of the box, Parallaxable calculates parallax offset for any collection/table cell.

For enable calculation you need to set:

tableView.isParallaxEnabled = true

Also you need to conform protocol Parallaxable with your cell like:


let parallaxOffsetMultiplier: CGFloat = 20

extension TableCell: Parallaxable {
    func updateVerticalParallaxOffset(with offset: CGFloat) {
        var targetCenter = contentView.center
        targetCenter.x = imageView.center.x
        targetCenter.y += offset * parallaxOffsetMultiplier
        imageView.center = targetCenter
    }

    func updateHorizontalParallaxOffset(with offset: CGFloat) {
        var targetCenter = contentView.center
        targetCenter.x += offset * parallaxOffsetMultiplier
        targetCenter.y = imageView.center.y
        imageView.center = targetCenter
    }
}

Code above will offset TableCell‘s imageView from center by offset.

offset is value from -1 to 1 representing position of cell relative to table/collection view’s center.

Latest podspec

{
    "name": "Parallaxable",
    "version": "0.0.2",
    "summary": "Beautiful parallax effect for your Table/Collection cells",
    "swift_version": "4.2",
    "homepage": "https://github.com/MaximKotliar/Parallaxable",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Maxim Kotliar": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/MaximKotliar/Parallaxable.git",
        "tag": "0.0.2"
    },
    "source_files": "Parallaxable/Source/**/*.{h,m,swift}"
}

Pin It on Pinterest

Share This