Skip to content

Commit 9701c2c

Browse files
committed
Documentation
1 parent 9ae7ed5 commit 9701c2c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

Sources/ComponentsKit/Components/Slider/UKSlider.swift

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,40 @@ import UIKit
55
open class UKSlider: UIView, UKComponent {
66
// MARK: - Properties
77

8+
/// A closure that is triggered when the `currentValue` changes.
89
public var onValueChange: (CGFloat) -> Void
910

11+
/// A model that defines the appearance properties.
1012
public var model: SliderVM {
1113
didSet {
1214
self.update(oldValue)
1315
}
1416
}
1517

18+
/// The current value of the slider.
1619
public var currentValue: CGFloat {
1720
didSet {
1821
guard self.currentValue != oldValue else { return }
19-
2022
self.updateSliderAppearance()
21-
2223
self.onValueChange(self.currentValue)
2324
}
2425
}
2526

2627
// MARK: - Subviews
2728

29+
/// The background view of the slider track.
2830
public let backgroundView = UIView()
31+
32+
/// The filled portion of the slider track.
2933
public let barView = UIView()
34+
35+
/// A shape layer used to render striped styling.
3036
public let stripedLayer = CAShapeLayer()
37+
38+
/// The draggable handle representing the current value.
3139
public let handleView = UIView()
40+
41+
/// An overlay view for handle for the `large` style.
3242
private let handleOverlayView = UIView()
3343

3444
// MARK: - Layout Constraints
@@ -46,14 +56,19 @@ open class UKSlider: UIView, UKComponent {
4656
self.model.progress(for: self.currentValue)
4757
}
4858

49-
// MARK: - UIView
59+
// MARK: - UIView Properties
5060

5161
open override var intrinsicContentSize: CGSize {
5262
return self.sizeThatFits(UIView.layoutFittingExpandedSize)
5363
}
5464

5565
// MARK: - Initialization
5666

67+
/// Initializer.
68+
/// - Parameters:
69+
/// - initialValue: The initial slider value. Defaults to `0`.
70+
/// - model: A model that defines the appearance properties.
71+
/// - onValueChange: A closure triggered whenever `currentValue` changes.
5772
public init(
5873
initialValue: CGFloat = 0,
5974
model: SliderVM = .init(),

0 commit comments

Comments
 (0)