Skip to content

Commit a4a993d

Browse files
refactor
1 parent 5c18915 commit a4a993d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

Sources/ComponentsKit/Divider/Models/DividerVM.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@ extension DividerVM {
3434
return 2.0
3535
}
3636
}
37+
}
38+
39+
// MARK: - UIKit Helpers
3740

41+
extension DividerVM {
3842
func shouldUpdateLayout(_ oldModel: Self) -> Bool {
3943
return self.orientation != oldModel.orientation
4044
|| self.size != oldModel.size

Sources/ComponentsKit/Divider/UKDivider.swift

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,12 @@ open class UKDivider: UIView, UKComponent {
1111
}
1212
}
1313

14-
// MARK: - UIView methods
14+
// MARK: - UIView Properties
1515

1616
open override var intrinsicContentSize: CGSize {
1717
return self.sizeThatFits(UIView.layoutFittingExpandedSize)
1818
}
1919

20-
open override func sizeThatFits(_ size: CGSize) -> CGSize {
21-
let lineSize = self.model.lineSize
22-
switch self.model.orientation {
23-
case .vertical:
24-
return CGSize(width: lineSize, height: size.height)
25-
case .horizontal:
26-
return CGSize(width: size.width, height: lineSize)
27-
}
28-
}
29-
3020
// MARK: - Initializers
3121

3222
/// Initializer.
@@ -61,4 +51,16 @@ open class UKDivider: UIView, UKComponent {
6151
self.invalidateIntrinsicContentSize()
6252
}
6353
}
54+
55+
// MARK: - UIView Methods
56+
57+
open override func sizeThatFits(_ size: CGSize) -> CGSize {
58+
let lineSize = self.model.lineSize
59+
switch self.model.orientation {
60+
case .vertical:
61+
return CGSize(width: lineSize, height: size.height)
62+
case .horizontal:
63+
return CGSize(width: size.width, height: lineSize)
64+
}
65+
}
6466
}

0 commit comments

Comments
 (0)