Skip to content

Commit

Permalink
Update NumberFormatter+Localize.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
rismay-luassat committed Jun 25, 2024
1 parent 03e8024 commit 771eb7f
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import Foundation

/// An extension of `NumberFormatter` to provide convenient static instances for formatting numbers.
extension NumberFormatter {

/// A static `NumberFormatter` for formatting integers.
///
/// This formatter is configured for decimal style with no fraction digits,
Expand Down Expand Up @@ -47,7 +46,8 @@ extension NumberFormatter {

/// A static `NumberFormatter` for formatting currency values, particularly dollars.
///
/// This formatter uses the currency style with a maximum of four and a minimum of two fraction digits.
/// This formatter uses the currency style with a maximum of four and a minimum of two fraction
/// digits.
///
/// Example:
/// ```
Expand All @@ -74,14 +74,16 @@ extension LocalizedValues {
/// Default implementation of `integerString` for types conforming to `LocalizedValues`.
///
/// It uses `NumberFormatter.integer` to convert the numeric value to a string.
/// Force unwrapping is used as the formatter should always successfully convert a number to a string.
/// Force unwrapping is used as the formatter should always successfully convert a number to a
/// string.
public func integerString() -> String {
NumberFormatter.integer.string(for: self)! // swiftlint:disable:this force_unwrapping
}

/// Returns a localized string representation of the conforming numeric type as a double.
///
/// It uses `NumberFormatter.double` to convert the numeric value to a string with two decimal points.
/// It uses `NumberFormatter.double` to convert the numeric value to a string with two decimal
/// points.
public func doubleString() -> String {
NumberFormatter.double.string(for: self)! // swiftlint:disable:this force_unwrapping
}
Expand Down

0 comments on commit 771eb7f

Please sign in to comment.