Shadow style
Closed this issue · 0 comments
artemnovichkov commented
Add a style for shadows
import UIKit
open class ShadowStyle {
public var opacity: CGFloat = 0.0
public var radius: CGFloat = 0.0
public var offset: CGSize = .zero
public var color: UIColor = .clear
var shadow: NSShadow {
let shadow = NSShadow()
shadow.shadowBlurRadius = radius
shadow.shadowOffset = offset
shadow.shadowColor = color.withAlphaComponent(opacity)
return shadow
}
}
// MARK: - Equatable
extension ShadowStyle: Equatable {
public static func == (lhs: ShadowStyle, rhs: ShadowStyle) -> Bool {
return lhs.color == rhs.color &&
lhs.offset == rhs.offset &&
lhs.radius == rhs.radius &&
lhs.opacity == rhs.opacity
}
}