Skip to content

Commit d1f5eb4

Browse files
committed
Fix warnings #30
1 parent 8fe10bf commit d1f5eb4

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Sources/CompactSlider/CompactSlider+OnChange.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ extension CompactSlider {
1111

1212
isValueChangingInternally = true
1313
defer {
14-
isValueChangingInternally = false
14+
Task { @MainActor in
15+
isValueChangingInternally = false
16+
}
1517
}
1618

1719
if progress.isMultipleValues {
@@ -49,10 +51,6 @@ extension CompactSlider {
4951
upperValue = convertProgressToValue(newValue.progresses[1])
5052
}
5153

52-
func convertProgressToValue(_ newValue: Double) -> Value {
53-
newValue.convertPercentageToValue(in: bounds, step: step?.linearStep() ?? 0.0)
54-
}
55-
5654
func onLowerValueChange(_ newValue: Value) {
5755
if isValueChangingInternally { return }
5856
progress.updateLowerProgress(convertValueToProgress(newValue))
@@ -82,6 +80,14 @@ extension CompactSlider {
8280
if isValueChangingInternally { return }
8381
progress.updatePolarPoint(newValue)
8482
}
83+
}
84+
85+
// MARK: - Convert values
86+
87+
extension CompactSlider {
88+
func convertProgressToValue(_ newValue: Double) -> Value {
89+
newValue.convertPercentageToValue(in: bounds, step: step?.linearStep() ?? 0.0)
90+
}
8591

8692
func convertValueToProgress(_ value: Value) -> Double {
8793
value.convertValueToPercentage(in: bounds)

0 commit comments

Comments
 (0)