这些是我一直遇到的错误,我一生无法解决。任何帮助将不胜感激!
let torrent: RemoteTorrent
var body: some View {
switch torrent.status {
case let .downloading(_, _, _, downloadRate, uploadRate, eta):
Box(label: Label("Statistics", systemImage: "speedometer")) {
HStack {
VStack(alignment: .leading) {
Label("Download Rate: \(ByteCountFormatter.humanReadableTransmissionSpeed(bytesPerSecond: downloadRate))", systemImage: "arrow.down.forward")
Label("Upload Rate: \(ByteCountFormatter.humanReadableTransmissionSpeed(bytesPerSecond: uploadRate))", systemImage: "arrow.up.forward")
.padding(.top)
if let humanReadableETA = eta.humanReadableDate {
Label("Time Remaining: \(humanReadableETA)", systemImage: "deskclock")
.padding(.top)
}
}.padding(TorrentDetailsView.innerDetailPadding)
Spacer()
}.padding(.top)
}
case let .seeding(_, uploadRate, ratio, totalUploaded, secondsSeeding, _):
Box(label: Label("Statistics", systemImage: "speedometer")) {
HStack {
VStack(alignment: .leading) {
Label("Upload Rate: \(ByteCountFormatter.humanReadableTransmissionSpeed(bytesPerSecond: uploadRate))", systemImage: "arrow.up.forward")
if let totalUploaded = totalUploaded {
Label("Uploaded: \(ByteCountFormatter.humanReadableFileSize(bytes: totalUploaded)) (Ratio: \(String(format: "%.2f", ratio)))", systemImage: "arrow.up.to.line")
.padding(.top)
}
if let humanReadableSeedingTime = secondsSeeding?.humanReadableDate {
Label("Seeding Time: \(humanReadableSeedingTime)", systemImage: "deskclock")
.padding(.top)
}
}.padding(TorrentDetailsView.innerDetailPadding)
Spacer()
}.padding(.top)
}
default:
EmptyView()
}
}
}