Presentation
- iOS
- 15.0+
- macOS
- 12.0+
- tvOS
- 15.0+
- watchOS
- 8.0+
struct Presentation
struct Presentation
s20FoundationEssentials4DateV0A20InternationalizationE19RelativeFormatStyleV12PresentationV
What are these?7G25F
import FoundationEssentials
import FoundationInternationalization
struct RelativeFormatStyle
struct Date
Date
represents a single point in time.
init(allowedFields: Set<Date.RelativeFormatStyle.Field>, presentation: Date.RelativeFormatStyle.Presentation = .numeric, unitsStyle: Date.RelativeFormatStyle.UnitsStyle = .wide, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, capitalizationContext: FormatStyleCapitalizationContext = .unknown)
init(from decoder: any Decoder) throws
init(presentation: Date.RelativeFormatStyle.Presentation = .numeric, unitsStyle: Date.RelativeFormatStyle.UnitsStyle = .wide, locale: Locale = .autoupdatingCurrent, calendar: Calendar = .autoupdatingCurrent, capitalizationContext: FormatStyleCapitalizationContext = .unknown)
var allowedFields: Set<Date.RelativeFormatStyle.Field> { get set }
The fields that can be used in the formatted output.
var calendar: Calendar
var capitalizationContext: FormatStyleCapitalizationContext
var locale: Locale
var presentation: Date.RelativeFormatStyle.Presentation
var unitsStyle: Date.RelativeFormatStyle.UnitsStyle
func format(_ destDate: Date) -> String
func locale(_ locale: Locale) -> Date.RelativeFormatStyle
struct UnitsStyle
typealias Field = Date.ComponentsFormatStyle.Field
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
init(from decoder: any Decoder) throws
static var named: Date.RelativeFormatStyle.Presentation { get }
“yesterday”, “2 days ago”, “last week”, “next week”; falls back to the numeric style if no name is available.
static var numeric: Date.RelativeFormatStyle.Presentation { get }
“1 day ago”, “2 days ago”, “1 week ago”, “in 1 week”
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.