StructureFoundationEssentials
Date.AnchoredRelativeFormatStyle
iOS 18.0+
iPadOS 18.0+
Mac Catalyst 18.0+
macOS 15.0+
tvOS 18.0+
watchOS 11.0+
A relative format style that is detached from the system time, and instead formats an anchor date relative to the format input.
struct AnchoredRelativeFormatStyle
Topics
Initializers
init(anchor: Date, allowedFields: Set<Date.AnchoredRelativeFormatStyle.Field>, presentation: Date.AnchoredRelativeFormatStyle.Presentation, unitsStyle: Date.AnchoredRelativeFormatStyle.UnitsStyle, locale: Locale, calendar: Calendar, capitalizationContext: FormatStyleCapitalizationContext)Create a relative format style that is detached from the system time, and instead formats an anchor date relative to the format input.init(anchor: Date, presentation: Date.AnchoredRelativeFormatStyle.Presentation, unitsStyle: Date.AnchoredRelativeFormatStyle.UnitsStyle, locale: Locale, calendar: Calendar, capitalizationContext: FormatStyleCapitalizationContext)Create a relative format style that is detached from the system time, and instead formats an anchor date relative to the format input.init(from: any Decoder) throws
Instance Properties
var allowedFields: Set<Date.AnchoredRelativeFormatStyle.Field>The fields that can be used in the formatted output.var anchor: DateThe date the formatted output refers to from the perspective of the input values.var calendar: Calendarvar capitalizationContext: FormatStyleCapitalizationContextvar locale: Localevar presentation: Date.AnchoredRelativeFormatStyle.Presentationvar unitsStyle: Date.AnchoredRelativeFormatStyle.UnitsStyle
Instance Methods
Type Aliases
Default Implementations
Relationships
Conforms To
DiscreteFormatStyleFormatStyleSwift.CopyableSwift.DecodableSwift.EncodableSwift.EquatableSwift.EscapableSwift.HashableSwift.SendableSwift.SendableMetatype