From 62bdae2c0e2ee2a4bb5b95e5cc6625dabd15ebf6 Mon Sep 17 00:00:00 2001 From: Serhiy Mytrovtsiy Date: Tue, 15 Mar 2022 19:03:40 +0100 Subject: [PATCH] feat: rounding size to 1 digit for GB and TB --- Kit/helpers.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Kit/helpers.swift b/Kit/helpers.swift index bf17819e..6cc532e3 100644 --- a/Kit/helpers.swift +++ b/Kit/helpers.swift @@ -135,9 +135,9 @@ public struct Units { case 1_024..<(1_024 * 1_024 * 1_024): return String(format: "%.0f MB", megabytes) case 1_024..<(1_024 * 1_024 * 1_024 * 1_024): - return String(format: "%.2f GB", gigabytes) + return String(format: "%.1f GB", gigabytes) case (1_024 * 1_024 * 1_024 * 1_024)...Int64.max: - return String(format: "%.2f TB", terabytes) + return String(format: "%.1f TB", terabytes) default: return String(format: "%.0f KB", kilobytes) } @@ -173,9 +173,9 @@ public struct DiskSize { case 1_000..<(1_000 * 1_000 * 1_000): return String(format: "%.0f MB", megabytes) case 1_000..<(1_000 * 1_000 * 1_000 * 1_000): - return String(format: "%.2f GB", gigabytes) + return String(format: "%.1f GB", gigabytes) case (1_000 * 1_000 * 1_000 * 1_000)...Int64.max: - return String(format: "%.2f TB", terabytes) + return String(format: "%.1f TB", terabytes) default: return String(format: "%.0f KB", kilobytes) }