Mercurial > public > geoquiz
comparison GeoQuiz/Components/FormatterExtension.swift @ 10:a793f33f05fb
refactor code and fix layout
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Sat, 08 Oct 2022 21:36:40 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
9:3540c7efc216 | 10:a793f33f05fb |
---|---|
1 // | |
2 // Formatters.swift | |
3 // GeoQuiz | |
4 // | |
5 // Created by Dennis Concepción Martín on 8/10/22. | |
6 // | |
7 | |
8 import Foundation | |
9 | |
10 extension Formatter { | |
11 static let withSeparator: NumberFormatter = { | |
12 let formatter = NumberFormatter() | |
13 formatter.numberStyle = .decimal | |
14 return formatter | |
15 }() | |
16 } | |
17 | |
18 extension Int { | |
19 var formattedWithSeparator: String { | |
20 return Formatter.withSeparator.string(for: self) ?? "" | |
21 } | |
22 } |