Skip to content

Instantly share code, notes, and snippets.

@RayPS
Created November 8, 2017 04:56
Show Gist options
  • Save RayPS/60f0e3cc56395d468d656cd26bd9255d to your computer and use it in GitHub Desktop.
Save RayPS/60f0e3cc56395d468d656cd26bd9255d to your computer and use it in GitHub Desktop.
Gradient Mask
let gradient = CAGradientLayer()
gradient.colors = [
UIColor.black.cgColor,
UIColor.black.cgColor,
UIColor.clear.cgColor
]
gradient.locations = [
0,
0.9,
1
]
gradient.frame = view.frame
view.layer.mask = gradient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment