CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

Sombra 1.0.3

Sombra 1.0.3

Maintained by Anthony Latsis.



Sombra 1.0.3

Sombra

A light native-style retroaction on CALayer to support vibrant image projections as shadows.

Usage

To have an image projection instead of a plane color as a shadow, you use shadowImage. The rest is set up the usual way using existing shadow properties.

view.layer.shadowOpacity = 0.8
view.layer.shadowOffset = CGSize(width: 0, height: 15)
view.layer.shadowRadius = 30
view.layer.shadowImage = UIImage().cgImage

Considerations

While using an image projection as a shadow, the value of shadowOpacity will be cached and the property itself set to zero. This is done for the regular shadow not to appear. Setting the image to nil will leave you with a regular shadow, if any (shadowOpacity > 0).
The image projection currently doesn't support animating through shadow properties.

Requirements

  • Xcode 9 +
  • Swift 4 +
  • iOS 10 +

Installation

Sombra can be integrated using CocoaPods. Specify it in your Podfile and run $ pod install.

platform :ios, '10.0'
use_frameworks!

target '<Your Target>' do
    pod 'Sombra'
end