This commit is contained in:
DDIsFriend
2023-08-18 17:28:57 +08:00
commit f0e8a1709d
4282 changed files with 192396 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
//
// UIView+Shadow.swift
// SwiftEntryKit
//
// Created by Daniel Huri on 4/25/18.
//
import UIKit
extension UIView {
func applyDropShadow(withOffset offset: CGSize,
opacity: Float,
radius: CGFloat,
color: UIColor) {
layer.applyDropShadow(withOffset: offset,
opacity: opacity,
radius: radius,
color: color)
}
func removeDropShadow() {
layer.removeDropShadow()
}
}
extension CALayer {
func applyDropShadow(withOffset offset: CGSize,
opacity: Float,
radius: CGFloat,
color: UIColor) {
shadowOffset = offset
shadowOpacity = opacity
shadowRadius = radius
shadowColor = color.cgColor
shouldRasterize = true
rasterizationScale = UIScreen.main.scale
}
func removeDropShadow() {
shadowOffset = .zero
shadowOpacity = 0
shadowRadius = 0
shadowColor = UIColor.clear.cgColor
shouldRasterize = false
}
}