Skip to content

Commit

Permalink
Use places as param name
Browse files Browse the repository at this point in the history
  • Loading branch information
MrSkwiggs committed Jan 29, 2025
1 parent a3ea078 commit b5222f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions Sources/Ignite/Extensions/FormatStyle-NonLocalizedDecimal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Foundation
extension FormatStyle where Self == FloatingPointFormatStyle<Double>, FormatInput == Double {
/// A format style that displays a floating point number with one decimal place, enforcing the use of a `.` as the decimal separator.
static var nonLocalizedDecimal: Self {
nonLocalizedDecimal(decimalPlaces: 1)
nonLocalizedDecimal(places: 1)
}

/// A format style that displays a floating point number enforcing the use of a `.` as the decimal separator.
/// - Parameter decimalPlaces: The number of decimal places to display. Defaults to 1.
static func nonLocalizedDecimal(decimalPlaces: Int = 1) -> Self {
let precision = max(0, decimalPlaces)
/// - Parameter places: The number of decimal places to display. Defaults to 1.
static func nonLocalizedDecimal(places: Int = 1) -> Self {
let precision = max(0, places)
return FloatingPointFormatStyle()
.precision(.fractionLength(0...precision))
.locale(Locale(identifier: "en_US"))
Expand All @@ -26,13 +26,13 @@ extension FormatStyle where Self == FloatingPointFormatStyle<Double>, FormatInpu
extension FormatStyle where Self == FloatingPointFormatStyle<Float>, FormatInput == Float {
/// A format style that displays a floating point number with one decimal place, enforcing the use of a `.` as the decimal separator.
static var nonLocalizedDecimal: Self {
nonLocalizedDecimal(decimalPlaces: 1)
nonLocalizedDecimal(places: 1)
}

/// A format style that displays a floating point number enforcing the use of a `.` as the decimal separator.
/// - Parameter decimalPlaces: The number of decimal places to display. Defaults to 1.
static func nonLocalizedDecimal(decimalPlaces: Int = 1) -> Self {
let precision = max(0, decimalPlaces)
/// - Parameter places: The number of decimal places to display. Defaults to 1.
static func nonLocalizedDecimal(places: Int = 1) -> Self {
let precision = max(0, places)
return FloatingPointFormatStyle()
.precision(.fractionLength(0...precision))
.locale(Locale(identifier: "en_US"))
Expand Down
4 changes: 2 additions & 2 deletions Sources/Ignite/Modifiers/Opacity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ struct OpacityModifier: HTMLModifier {
/// - Returns: The modified HTML with opacity applied
func body(content: some HTML) -> any HTML {
if let percentage, percentage != 100% {
content.style(.opacity, percentage.value.formatted(.nonLocalizedDecimal(decimalPlaces: 3)))
content.style(.opacity, percentage.value.formatted(.nonLocalizedDecimal(places: 3)))
} else if let doubleValue, doubleValue != 1 {
content.style(.opacity, doubleValue.formatted(.nonLocalizedDecimal(decimalPlaces: 3)))
content.style(.opacity, doubleValue.formatted(.nonLocalizedDecimal(places: 3)))
}
content
}
Expand Down

0 comments on commit b5222f5

Please sign in to comment.