in Swift, use
formatted
methods directly on the types you want to format, optionally usingFormatStyle
and its subtypes to customize formatter output. This approach supports dates, integers, floating-point numbers, measurements, sequences, and person name components. Foundation caches identically-configured formatter instances internally, allowing you to focus on your app’s formatting needs.Data Formatting | Apple Developer Documentation https://developer.apple.com/documentation/foundation/data_formatting
Decimal.FormatStyle
(viaParseableFormatStyle
)Decimal.FormatStyle.Attributed
Decimal.FormatStyle.Currency
(viaParseableFormatStyle
)Decimal.FormatStyle.Percent
(viaParseableFormatStyle
)FloatingPointFormatStyle
(viaParseableFormatStyle
)FloatingPointFormatStyle.Attributed
FloatingPointFormatStyle.Currency
(viaParseableFormatStyle
)FloatingPointFormatStyle.Percent
(viaParseableFormatStyle
)IntegerFormatStyle
(viaParseableFormatStyle
)IntegerFormatStyle.Attributed
IntegerFormatStyle.Currency
(viaParseableFormatStyle
)IntegerFormatStyle.Percent
(viaParseableFormatStyle
)
Date.FormatStyle
(viaParseableFormatStyle
)Date.AttributedStyle
Date.ISO8601FormatStyle
(viaParseableFormatStyle
)Date.VerbatimFormatStyle
(viaParseableFormatStyle
)Date.RelativeFormatStyle
Date.IntervalFormatStyle
Date.ComponentsFormatStyle
Duration.TimeFormatStyle
Duration.UnitsFormatStyle
- (StoreKit)
Product.SubscriptionPeriod.Unit.FormatStyle