Skip to content

Commit eeaa898

Browse files
committed
Update ProgressView to take any BinaryFloatingPoint (not just Double)
1 parent 629ad25 commit eeaa898

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/SwiftCrossUI/Views/ProgressView.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public struct ProgressView<Label: View>: View {
4545

4646
/// Creates a progress bar view. If `value` is `nil`, an indeterminate progress
4747
/// bar will be shown.
48-
public init(_ label: Label, value: Double?) {
48+
public init<Value: BinaryFloatingPoint>(_ label: Label, value: Value?) {
4949
self.label = label
5050
self.kind = .bar
51-
self.progress = value
51+
self.progress = value.map(Double.init)
5252
}
5353
}
5454

@@ -69,10 +69,10 @@ extension ProgressView where Label == EmptyView {
6969

7070
/// Creates a progress bar view. If `value` is `nil`, an indeterminate progress
7171
/// bar will be shown.
72-
public init(value: Double?) {
72+
public init<Value: BinaryFloatingPoint>(value: Value?) {
7373
self.label = EmptyView()
7474
self.kind = .bar
75-
self.progress = value
75+
self.progress = value.map(Double.init)
7676
}
7777
}
7878

@@ -93,10 +93,10 @@ extension ProgressView where Label == Text {
9393

9494
/// Creates a progress bar view. If `value` is `nil`, an indeterminate progress
9595
/// bar will be shown.
96-
public init(_ label: String, value: Double?) {
96+
public init<Value: BinaryFloatingPoint>(_ label: String, value: Value?) {
9797
self.label = Text(label)
9898
self.kind = .bar
99-
self.progress = value
99+
self.progress = value.map(Double.init)
100100
}
101101
}
102102

0 commit comments

Comments
 (0)