Skip to content

Commit 78baf60

Browse files
update constraints in UKCountdown
1 parent 2690486 commit 78baf60

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

Sources/ComponentsKit/Countdown/Models/CountdownVM.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,6 @@ extension CountdownVM {
199199
}
200200

201201
extension CountdownVM {
202-
func shouldUpdateHeight(_ oldModel: Self) -> Bool {
203-
return self.style != oldModel.style
204-
|| self.height != oldModel.height
205-
}
206-
207202
func shouldRecalculateWidth(_ oldModel: Self) -> Bool {
208203
return self.unitsStyle != oldModel.unitsStyle
209204
|| self.style != oldModel.style
@@ -240,4 +235,9 @@ extension CountdownVM {
240235
return false
241236
}
242237
}
238+
239+
func shouldUpdateHeight(_ oldModel: Self) -> Bool {
240+
return self.style != oldModel.style
241+
|| self.height != oldModel.height
242+
}
243243
}

Sources/ComponentsKit/Countdown/UKCountdown.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,24 +141,28 @@ public class UKCountdown: UIView, UKComponent {
141141
// MARK: - Layout
142142

143143
private func layout() {
144-
self.stackView.horizontally()
145144
self.stackView.centerVertically()
145+
self.stackView.centerHorizontally()
146146

147147
self.stackView.topAnchor.constraint(
148148
greaterThanOrEqualTo: self.topAnchor
149149
).isActive = true
150150
self.stackView.bottomAnchor.constraint(
151151
lessThanOrEqualTo: self.bottomAnchor
152152
).isActive = true
153+
self.stackView.leadingAnchor.constraint(
154+
greaterThanOrEqualTo: self.leadingAnchor
155+
).isActive = true
156+
self.stackView.trailingAnchor.constraint(
157+
lessThanOrEqualTo: self.trailingAnchor
158+
).isActive = true
153159

154160
self.daysConstraints.width = self.daysLabel.widthAnchor.constraint(
155161
equalToConstant: self.model.defaultMinWidth
156162
)
157-
self.daysConstraints.width?.priority = .required
158163
self.daysConstraints.width?.isActive = true
159164

160165
self.daysConstraints.height = self.daysLabel.heightAnchor.constraint(greaterThanOrEqualToConstant: self.model.height)
161-
self.daysConstraints.height?.priority = .required
162166
self.daysConstraints.height?.isActive = true
163167

164168
self.hoursLabel.widthAnchor.constraint(equalTo: self.daysLabel.widthAnchor).isActive = true

0 commit comments

Comments
 (0)