Swiftpack.co -  lucamegh/Umbra as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
lucamegh/Umbra
Make UIKit shadows great again.
.package(url: "https://github.com/lucamegh/Umbra.git", from: "1.0.0")

Umbra 🌑

Installation

Umbra is distributed using Swift Package Manager. To install it into a project, simply add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/lucamegh/Umbra", from: "1.0.0")
    ],
    ...
)

Usage

Setting shadows

Umbra makes it easy to add shadows to your views. Just create a UIView.Shadow and assign it to your view via the shadow property.

view.shadow = UIView.Shadow(
    color: .black,
    opacity: 0.25,
    offset: CGSize(width: 0, height: 2),
    radius: 2
)

Changing single shadow properties is easier too:

view.shadow.color = .blue // Umbra
view.layer.shadowColor = UIColor.black.cgColor // UIKit

Static factory methods

Given that all the shadow properties are contained within the UIView.Shadow type, you're encouraged to declare static factory methods to make shadows consistent across your entire app:

extension UIView.Shadow {

    enum Elevation: Int { 

        case zero, one, two, three, four
    }

    static func elevation(_ elevation: Elevation) -> Self {
        ...
    }
}

view.shadow = .elevation(.four)

Umbra comes with a built-in static factory method that will save you a lot of arguments with your designer:

view.shadow = .sketch(color: .black, alpha: 0.25, x: 0, y: 2, blur: 8)

GitHub

link
Stars: 0
Last commit: 2 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

Umbra 1.0.0
2 weeks ago

The first release of Umbra.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API