view GeoQuiz/Components/FormatterExtension.swift @ 21:b145c408f791

refactor code
author Dennis C. M. <dennis@denniscm.com>
date Tue, 25 Oct 2022 15:30:01 +0200
parents a793f33f05fb
children
line wrap: on
line source

//
//  Formatters.swift
//  GeoQuiz
//
//  Created by Dennis Concepción Martín on 8/10/22.
//

import Foundation

extension Formatter {
    static let withSeparator: NumberFormatter = {
        let formatter = NumberFormatter()
        formatter.numberStyle = .decimal
        return formatter
    }()
}

extension Int {
    var formattedWithSeparator: String {
        return Formatter.withSeparator.string(for: self) ?? ""
    }
}