Skip to content

A simple retroaction on CALayer to support vibrant image projections as shadows.

License

Notifications You must be signed in to change notification settings

AnthonyLatsis/Sombra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple retroaction on CALayer to support vibrant image projections as shadows.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published