One Logo Pool Ball
Foundation · IOS API REFERENCE

Date.VerbatimFormatStyle

struct · iOS 15.0+ · SDK 27.1

struct VerbatimFormatStyle

A style that formats a date with an explicitly-specified style.

Members (17)

get · iOS 18.0+

attributedStyle

TypeScript
get attributedStyle(): Date_VerbatimFormatStyle_Attributed
Swift declaration
var attributedStyle: Date.VerbatimFormatStyle.Attributed { get }

Return the type preserving attributed variant of this style. This style attributes the formatted date with the `AttributeScopes.FoundationAttributes.DateFormatFieldAttribute`.

get · iOS 15.0+ · Deprecated in iOS 18.0

attributed

TypeScript
get attributed(): Date_AttributedStyle
Swift declaration
var attributed: Date.AttributedStyle { get }

Returns a type erased attributed variant of this style.

method · iOS 18.0+

discreteInput

TypeScript
discreteInputAfter(input: globalThis.Date): (globalThis.Date) | null
Swift declaration
func discreteInput(after input: Date) -> Date?

The next discretization boundary after the given input. Use this function to determine the next "greater" input that warrants updating the formatted output. The following example prints all possible outputs the format style can produce upwards starting from the `startInput`: ```swift var previousInput = startInput while let nextInput = style.discreteInput(after: previousInput) { print(style.format(nextInput)) previousInput = nextInput } ``` - Returns: For most `input`s, the method returns the "smallest" value "greater" than `input` for which the style produces a different ``FormatStyle/FormatOutput``, or `nil` if no such value exists. For some input values, the function may also return a value "greater" than `input` for which the style still produces the same ``FormatStyle/FormatOutput`` as for `input`.

method · iOS 18.0+

discreteInput

TypeScript
discreteInputBefore(input: globalThis.Date): (globalThis.Date) | null
Swift declaration
func discreteInput(before input: Date) -> Date?

The next discretization boundary before the given input. Use this function to determine the next "smaller" input that warrants updating the formatted output. The following example prints all possible outputs the format style can produce downwards starting from the `startInput`: ```swift var previousInput = startInput while let nextInput = style.discreteInput(before: previousInput) { print(style.format(nextInput)) previousInput = nextInput } ``` - Returns: For most `input`s, the method returns the "greatest" value "smaller" than `input` for which the style produces a different ``FormatStyle/FormatOutput``, or `nil` if no such value exists. For some input values, the function may also return a value "smaller" than `input` for which the style still produces the same ``FormatStyle/FormatOutput`` as for `input`.

get · iOS 15.0+

parseStrategy

TypeScript
get parseStrategy(): Date_ParseStrategy
Swift declaration
var parseStrategy: Date.ParseStrategy { get }

A `ParseStrategy` that can be used to parse this `FormatStyle`'s output

method · iOS 18.0+

input

TypeScript
inputAfter(input: globalThis.Date): (globalThis.Date) | null
Swift declaration
func input(after input: Date) -> Date?

The next input value after the given input. Use this function to determine if the return value provided by ``discreteInput(before:)`` is precise enough for your use case for any input `y`: ```swift guard let x = style.discreteInput(before: y) else { return } let z = style.input(after: x) ?? y ``` If the distance between `x` and `z` is too large for the precision you require, you may want to manually probe ``FormatStyle/format(_:)`` at a higher rate in that interval, as there is no guarantee for what the output will be in that interval. - Returns: The next "greater" input value that can be represented by ``FormatStyle/FormatInput`` or an underlying representation the format style uses internally.

method · iOS 18.0+

input

TypeScript
inputBefore(input: globalThis.Date): (globalThis.Date) | null
Swift declaration
func input(before input: Date) -> Date?

The next input value before the given input. Use this function to determine if the return value provided by ``discreteInput(after:)`` is precise enough for your use case for any input `y`: ```swift guard let x = style.discreteInput(after: y) else { return } let z = style.input(before: x) ?? y ``` If the distance between `z` and `x` is too large for the precision you require, you may want to manually probe ``FormatStyle/format(_:)`` at a higher rate in that interval, as there is no guarantee for what the output will be in that interval. - Returns: The next "smalller" input value that can be represented by ``FormatStyle/FormatInput`` or an underlying representation the format style uses internally.

init · iOS 15.0+

init

TypeScript
static init(format: Date_FormatString, locale: (Locale) | null, timeZone: TimeZone, calendar: Calendar): Date_VerbatimFormatStyle
Swift declaration
init(format: Date.FormatString, locale: Locale? = nil, timeZone: TimeZone, calendar: Calendar)
method · iOS 15.0+

format

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

Formats a value, using this style. Use this method when you want to create a single style instance, and then use it to format multiple values. - Parameter value: The value to format. - Returns: A representation of `value`, in the ``FormatOutput`` type, formatted according to the style's configuration.

get · iOS 15.0+

locale

TypeScript
get locale(): (Locale) | null
Swift declaration
var locale: Locale?

Use system locale if nil or unspecified.

set · iOS 15.0+

locale

TypeScript
set locale(value: (Locale) | null)
Swift declaration
var locale: Locale?

Use system locale if nil or unspecified.

method · iOS 15.0+

locale

TypeScript
locale97872(locale: Locale): Date_VerbatimFormatStyle
Swift declaration
func locale(_ locale: Locale) -> Date.VerbatimFormatStyle

Modifies the format style to use the specified locale. Use this format style to change the locale used by an existing format style. - Parameter locale: The locale to apply to the format style. - Returns: A format style modified to use the provided locale.

get · iOS 15.0+

calendar

TypeScript
get calendar(): Calendar
Swift declaration
var calendar: Calendar
set · iOS 15.0+

calendar

TypeScript
set calendar(value: Calendar)
Swift declaration
var calendar: Calendar
get · iOS 15.0+

timeZone

TypeScript
get timeZone(): TimeZone
Swift declaration
var timeZone: TimeZone
set · iOS 15.0+

timeZone

TypeScript
set timeZone(value: TimeZone)
Swift declaration
var timeZone: TimeZone
method · iOS 16.0+

consuming

TypeScript
consuming(input: string, index: SDKHandle, bounds: SDKHandle): ({ "upperBound": SDKHandle; "output": globalThis.Date }) | null
Swift declaration
func consuming(_ input: String, startingAt index: String.Index, in bounds: Range<String.Index>) throws -> (upperBound: String.Index, output: Date)?

Process the input string within the specified bounds, beginning at the given index, and return the end position (upper bound) of the match and the produced output. - Parameters: - input: The string in which the match is performed. - index: An index of `input` at which to begin matching. - bounds: The bounds in `input` in which the match is performed. - Returns: The upper bound where the match terminates and a matched instance, or `nil` if there isn't a match.

Skipped declarations

No declarations were skipped in this snapshot.

All Foundation types →