import Foundation

enum Formatters {
    static let percent: NumberFormatter = {
        let formatter = NumberFormatter()
        formatter.numberStyle = .percent
        formatter.minimumFractionDigits = 0
        formatter.maximumFractionDigits = 0
        return formatter
    }()

    static func percentLabel(_ value: Double) -> String {
        percent.string(from: NSNumber(value: value)) ?? "\(Int(value * 100))%"
    }
}
