Skip to content

Commit a708a5c

Browse files
merge with ukcard
2 parents 4566f9a + 94e2c52 commit a708a5c

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Sources/ComponentsKit/Components/Card/UKCard.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,7 @@ extension UKCard {
142142
view.layer.cornerRadius = model.cornerRadius.value
143143
view.layer.borderWidth = 1
144144
view.layer.borderColor = UniversalColor.divider.cgColor
145-
view.layer.shadowRadius = model.shadow.radius
146-
view.layer.shadowOffset = model.shadow.offset
147-
view.layer.shadowColor = model.shadow.color.cgColor
148-
view.layer.shadowOpacity = 1
145+
view.shadow(model.shadow)
149146
}
150147

151148
static func contentView(_ view: UIView, model: Model) {

Sources/ComponentsKit/Shared/Types/Shadow.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import SwiftUI
2+
import UIKit
23

34
/// Defines shadow options for components.
45
public enum Shadow: Hashable {
@@ -51,6 +52,17 @@ extension Shadow {
5152
}
5253
}
5354

55+
// MARK: - UIKit + Shadow
56+
57+
extension UIView {
58+
func shadow(_ shadow: Shadow) {
59+
self.layer.shadowRadius = shadow.radius
60+
self.layer.shadowOffset = shadow.offset
61+
self.layer.shadowColor = shadow.color.cgColor
62+
self.layer.shadowOpacity = 1
63+
}
64+
}
65+
5466
// MARK: - SwiftUI + Shadow
5567

5668
extension View {

0 commit comments

Comments
 (0)