Skip to content

Commit d1e38af

Browse files
committed
fix code
1 parent cecd0a3 commit d1e38af

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

Sources/FoundationInternationalization/ProgressReporter/ProgressReporter+FileFormatStyle.swift

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -124,26 +124,18 @@ extension ProgressReporter.FileFormatStyle: FormatStyle {
124124

125125
let properties = reporter.withProperties(\.self)
126126

127-
if let totalFileCount = properties.totalFileCount {
128-
let completedFileCount = properties.completedFileCount ?? 0
129-
fileCountString = "\(completedFileCount.formatted(IntegerFormatStyle<Int>(locale: self.locale))) / \(totalFileCount.formatted(IntegerFormatStyle<Int>(locale: self.locale)))"
130-
}
131-
132-
if let totalByteCount = properties.totalByteCount {
133-
let completedByteCount = properties.completedByteCount ?? 0
134-
byteCountString = "\(completedByteCount.formatted(ByteCountFormatStyle(locale: self.locale))) / \(totalByteCount.formatted(ByteCountFormatStyle(locale: self.locale)))"
135-
}
136-
137-
if let throughput = properties.throughput {
138-
throughputString = "\(throughput.formatted(ByteCountFormatStyle(locale: self.locale)))/s"
139-
}
140-
141-
if let timeRemaining = properties.estimatedTimeRemaining {
142-
var formatStyle = Duration.UnitsFormatStyle(allowedUnits: [.hours, .minutes], width: .wide)
143-
formatStyle.locale = self.locale
144-
timeRemainingString = "\(timeRemaining.formatted(formatStyle)) remaining"
145-
}
127+
128+
fileCountString = "\(properties.completedFileCount.formatted(IntegerFormatStyle<Int>(locale: self.locale))) / \(properties.totalFileCount.formatted(IntegerFormatStyle<Int>(locale: self.locale)))"
146129

130+
131+
byteCountString = "\(properties.completedByteCount.formatted(ByteCountFormatStyle(locale: self.locale))) / \(properties.totalByteCount.formatted(ByteCountFormatStyle(locale: self.locale)))"
132+
133+
throughputString = "\(properties.throughput.formatted(ByteCountFormatStyle(locale: self.locale)))/s"
134+
135+
var formatStyle = Duration.UnitsFormatStyle(allowedUnits: [.hours, .minutes], width: .wide)
136+
formatStyle.locale = self.locale
137+
timeRemainingString = "\(properties.estimatedTimeRemaining.formatted(formatStyle)) remaining"
138+
147139
return """
148140
\(fileCountString ?? "")
149141
\(byteCountString ?? "")

0 commit comments

Comments
 (0)