File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Examples/DemosApp/DemosApp/ComponentsPreview/PreviewPages
Sources/ComponentsKit/Divider Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import UIKit
4
4
5
5
struct DividerPreview : View {
6
6
@State private var model = DividerVM ( )
7
-
7
+
8
8
var body : some View {
9
9
VStack {
10
10
PreviewWrapper ( title: " UIKit " ) {
Original file line number Diff line number Diff line change 1
1
import UIKit
2
2
3
+ /// A UIKit component that displays a separating line.
3
4
open class UKDivider : UIView , UKComponent {
5
+ // MARK: - Properties
6
+
7
+ /// A model that defines the appearance properties.
4
8
public var model : DividerVM {
5
9
didSet {
6
10
self . update ( oldValue)
7
11
}
8
12
}
9
13
14
+ // MARK: - Initializers
15
+
16
+ /// Initializer.
17
+ /// - Parameters:
18
+ /// - model: A model that defines the appearance properties.
10
19
public init ( model: DividerVM = . init( ) ) {
11
20
self . model = model
12
21
super. init ( frame: . zero)
@@ -17,10 +26,14 @@ open class UKDivider: UIView, UKComponent {
17
26
fatalError ( " init(coder:) has not been implemented " )
18
27
}
19
28
29
+ // MARK: - Setup
30
+
20
31
private func setup( ) {
21
32
self . backgroundColor = self . model. color. uiColor
22
33
}
23
34
35
+ // MARK: - Update
36
+
24
37
public func update( _ oldModel: DividerVM ) {
25
38
guard self . model != oldModel else { return }
26
39
@@ -33,10 +46,14 @@ open class UKDivider: UIView, UKComponent {
33
46
self . setNeedsLayout ( )
34
47
}
35
48
49
+ // MARK: - Layout
50
+
36
51
open override func layoutSubviews( ) {
37
52
super. layoutSubviews ( )
38
53
}
39
54
55
+ // MARK: - UIView Properties
56
+
40
57
open override var intrinsicContentSize : CGSize {
41
58
return self . sizeThatFits ( UIView . layoutFittingExpandedSize)
42
59
}
You can’t perform that action at this time.
0 commit comments