Added case iterable

This commit is contained in:
Pavel Lukandiy 2019-03-17 14:09:08 +05:00
parent 1b6d77f34c
commit a21847b7ff
2 changed files with 2 additions and 5 deletions

View File

@ -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 {

View File

@ -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 }