Latest 0.2.8
Homepage https://github.com/rockbruno/SlidingGradientView
License MIT
Platforms ios 9.0
Authors

Version
License
Platform

SlidingGradientView adds a sliding gradient to images in order to give the impression that something is loading. This is mostly meant to be used with images that resemble placeholders.

Loading

Usage

let image = UIImage(named: "placeholderEvents")
let placeholderView = SlidingGradientView(image: image)
//addSubview and constraints
placeholderView.startAnimating()

Customization

By default, SlidingGradientView uses a gradient that starts and end at RGB 248 248 248 and traverses 120% of the screen’s bounds in 0.7 seconds. You can edit these properties by creating a GradientProperties object like this:

//Use UIColor.white.withAlphaComponent(0) for transparency, not UiColor.clear!
let gradientColors = [
                      GradientColor(color: UIColor.white.withAlphaComponent(0), location: 0),
                      GradientColor(color: UIColor.red, location: 0.5),
                      GradientColor(color: UIColor.white.withAlphaComponent(0), location: 1)
                     ]
let slidingProperties = SlidingProperties(fromX: 0, toX: 100, animationDuration: 3)
let properties = GradientProperties(gradientWidth: 300, gradientColors: gradientColors, slidingProperties: slidingProperties)
let placeHolder2 = SlidingGradientView(image: image, properties: properties)

Installation

CocoaPods

pod "SlidingGradientView"

Author

rockbruno, [email protected]

License

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

Latest podspec

{
    "name": "SlidingGradientView",
    "version": "0.2.8",
    "summary": "Easily add sliding gradient effects to images. Meant to be used as loading placeholder views.",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/rockbruno/SlidingGradientView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "rockbruno": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rockbruno/SlidingGradientView.git",
        "branch": "master",
        "tag": "0.2.8"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source_files": "SlidingGradientView/Sources/**/*",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This