Added case iterable
This commit is contained in:
parent
1b6d77f34c
commit
a21847b7ff
|
|
@ -26,7 +26,7 @@ public extension NumberFormattingService {
|
|||
|
||||
/// Computed static property. Use only once for `formatters` field implementation!
|
||||
static var computedFormatters: [NumberFormatType: NumberFormatter] {
|
||||
return Dictionary(uniqueKeysWithValues: NumberFormatType.allOptions.map { ($0, $0.numberFormatter) })
|
||||
return Dictionary(uniqueKeysWithValues: NumberFormatType.allCases.map { ($0, $0.numberFormatter) })
|
||||
}
|
||||
|
||||
func numberFormatter(for format: NumberFormatType) -> NumberFormatter {
|
||||
|
|
|
|||
|
|
@ -23,10 +23,7 @@
|
|||
import Foundation
|
||||
|
||||
/// Protocol for describing number format.
|
||||
public protocol NumberFormat: Hashable {
|
||||
|
||||
/// All available options.
|
||||
static var allOptions: [Self] { get }
|
||||
public protocol NumberFormat: Hashable, CaseIterable {
|
||||
|
||||
/// A NumberFormatter instance for this format.
|
||||
var numberFormatter: NumberFormatter { get }
|
||||
|
|
|
|||
Loading…
Reference in New Issue