Skip to content

Commit 2182d0d

Browse files
committed
add documentation comments to Elevation
1 parent 93e6acb commit 2182d0d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Sources/YCoreUI/Components/Elevation.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,29 @@
88

99
import UIKit
1010

11+
/// Encapsulate design shadows and apply them to view.
1112
public struct Elevation {
13+
/// The offset of the layer’s shadow.
1214
public let offset: CGSize
15+
/// The blur of the layers. shadow.
1316
public let blur: CGFloat
17+
/// The spread of the layers. shadow.
1418
public let spread: CGFloat
19+
/// The color of the layer’s shadow.
1520
public let color: UIColor
21+
/// The opacity of the layer’s shadow.
1622
public let opacity: CGFloat
23+
/// Flag to set shadow path. Default is `true`.
1724
public let useShadowPath: Bool
1825

26+
/// Initializes `Elevation`.
27+
/// - Parameters:
28+
/// - offset: the offset of the layer’s shadow
29+
/// - blur: the blur of the layers. shadow
30+
/// - spread: the spread of the layers. shadow
31+
/// - color: the color of the layer’s shadow
32+
/// - opacity: the opacity of the layer’s shadow
33+
/// - useShadowPath: flag to set shadow path. Default is `true`
1934
public init(
2035
offset: CGSize,
2136
blur: CGFloat,
@@ -32,6 +47,10 @@ public struct Elevation {
3247
self.useShadowPath = useShadowPath
3348
}
3449

50+
/// Applies elevation to a layer.
51+
/// - Parameters:
52+
/// - layer: layer of the corresponding view
53+
/// - cornerRadius: the radius to use when drawing rounded corners for the layer’s background.
3554
public func apply(layer: CALayer, cornerRadius: CGFloat) {
3655
guard useShadowPath else { return }
3756

0 commit comments

Comments
 (0)