One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.AttributedStyle

struct · iOS 15.0+ · Deprecated in iOS 18.0 · SDK 27.1

struct AttributedStyle

A structure that creates a locale-appropriate attributed string representation of a date instance. Use a ``Date/FormatStyle`` instance to customize the lexical representation of a date as a string. Use the format style's ``Date/FormatStyle/attributed`` property to customize the visual representation of the date as a string. Attributed strings can represent the subcomponent characters, words, and phrases of a string with a custom combination of font size, weight, and color.

Members (2)

method · iOS 15.0+ · Deprecated in iOS 18.0

format

TypeScript
format(value: globalThis.Date): AttributedString
Swift declaration
func format(_ value: Date) -> AttributedString

Creates a locale-aware attributed string representation from a date value. Once you create a style, you can use it to format dates multiple times. - Parameter value: The date to format. - Returns: An attributed string representation of the date.

method · iOS 15.0+ · Deprecated in iOS 18.0

locale

TypeScript
locale(locale: Locale): Date_AttributedStyle
Swift declaration
func locale(_ locale: Locale) -> Date.AttributedStyle

Modifies the date attributed style to use the specified locale. - Parameter locale: The locale to use when formatting a date. - Returns: A date attributed style with the provided locale.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →