@@ -46,7 +46,6 @@ open class UKSlider: UIView, UKComponent {
4646 private var barViewConstraints = LayoutConstraints ( )
4747 private var backgroundViewConstraints = LayoutConstraints ( )
4848 private var handleViewConstraints = LayoutConstraints ( )
49- private var handleOverlayViewConstraints = LayoutConstraints ( )
5049
5150 // MARK: - Private Properties
5251
@@ -121,9 +120,6 @@ open class UKSlider: UIView, UKComponent {
121120 self . handleViewConstraints. height? . constant = self . model. handleSize. height
122121 self . handleViewConstraints. width? . constant = self . model. handleSize. width
123122
124- self . handleOverlayViewConstraints. height? . constant = self . model. handleOverlaySide
125- self . handleOverlayViewConstraints. width? . constant = self . model. handleOverlaySide
126-
127123 UIView . performWithoutAnimation {
128124 self . layoutIfNeeded ( )
129125 }
@@ -168,13 +164,11 @@ open class UKSlider: UIView, UKComponent {
168164 self . handleView. centerVertically ( )
169165 }
170166
171- self . handleOverlayViewConstraints = . merged {
172- self . handleOverlayView. center ( )
173- self . handleOverlayView. size (
174- width: self . model. handleOverlaySide,
175- height: self . model. handleOverlaySide
176- )
177- }
167+ self . handleOverlayView. center ( )
168+ self . handleOverlayView. size (
169+ width: self . model. handleOverlaySide,
170+ height: self . model. handleOverlaySide
171+ )
178172 }
179173
180174 open override func layoutSubviews( ) {
@@ -189,6 +183,9 @@ open class UKSlider: UIView, UKComponent {
189183 self . handleView. layer. cornerRadius =
190184 self . model. cornerRadius ( for: self . handleView. bounds. width)
191185
186+ self . handleOverlayView. layer. cornerRadius =
187+ self . model. cornerRadius ( for: self . handleOverlayView. bounds. width)
188+
192189 self . updateSliderAppearance ( )
193190 self . model. validateMinMaxValues ( )
194191 }
@@ -282,13 +279,9 @@ extension UKSlider {
282279 }
283280
284281 static func handleOverlayView( _ view: UIView , model: SliderVM ) {
285- if model. size == . large {
286- view. isHidden = false
287- view. backgroundColor = model. color. contrast. uiColor
288- view. layer. cornerRadius = model. cornerRadius ( for: model. handleOverlaySide)
289- } else {
290- view. isHidden = true
291- }
282+ view. isVisible = model. isHandleOverlayVisible
283+ view. backgroundColor = model. color. contrast. uiColor
284+ view. layer. cornerRadius = model. cornerRadius ( for: model. handleOverlaySide)
292285 }
293286 }
294287}
0 commit comments