Refactor project structure and API

This commit is contained in:
Micha
2025-11-15 19:49:28 +01:00
parent 23ffe1268a
commit 7593a781f2
33 changed files with 966 additions and 404 deletions

View File

@@ -0,0 +1,23 @@
//
// ByteFormatting.swift
// iKeyMon
//
// Created by tracer on 01.04.25.
//
import Foundation
extension Int {
func toNiceBinaryUnit() -> String {
let units = ["B", "KB", "MB", "GB", "TB", "PB"]
var value = Double(self)
var index = 0
while value >= 1024 && index < units.count - 1 {
value /= 1024
index += 1
}
return String(format: "%.2f %@", value, units[index])
}
}