Skip to content

quanvo87/ViewGlower

Repository files navigation

ViewGlower

Make any UIView glow ✨

Version License Platform

Example

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

Requirements

Swift 4

Installation

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

pod 'ViewGlower'

Usage

Import the framework:

import ViewGlower

Initialize an instance of ViewGlower:

class ViewController: UIViewController {
    let viewGlower = ViewGlower()

    ...
}

Pass it a UIView:

let barButton: UIBarButtonItem!
let button: UIButton!

...

viewGlower.glow(barButton.customView)

viewGlower.glow(button.imageView)

Note: Calling glow() in viewDidLoad() does not work.

Customize

func glow(_ view: UIView?,
	  color: UIColor = UIColor.white,
	  from: CGFloat = 0,
	  to: CGFloat = 0.9,
	  duration: CFTimeInterval = 1,
	  shouldRepeat: Bool = true)

Stop glowing

func stopGlowing(_ view: UIView?)

Acknowledgements

Modified from https://github.com/thesecretlab/UIView-Glow.

Icon in example from https://www.shareicon.net/cute-emoticons-emoji-feelings-smileys-847494.

Author

quanvo87, qvo1987@gmail.com

License

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