Generated from iOS SDK 27.1. Availability is shown on each declaration; permissions and entitlements still apply.
Functions and constants
init · iOS 26.0+init
TypeScriptstatic init(transferable: AttributedTextFormatting_Transferable, environment: _SwiftUICore_EnvironmentValues): _Foundation_AttributedString
Swift declarationinit(transferable: AttributedTextFormatting.Transferable, in environment: EnvironmentValues) throws
Extract an attributed string from SwiftUI's transferable representation
in a certain environment.
Use this initializer with a ``AttributedTextFormatting/Transferable``
that was imported, e.g. in the `action` closure of the
``View/dropDestination(for:action:isTargeted)`` modifier.
- Note: This initializer applies the
``AttributedTextFormattingDefinition`` in the given `environment` to the
imported text before returning.
- SeeAlso: ``View/attributedTextFormattingDefinition(_:)-uc57``,
``AttributedTextValueConstraint/constrain(_:)-6cp64``
method · iOS 26.0+transformAttributes
TypeScripttransformAttributes(selection: AttributedTextSelection, body: ((arg0: _Foundation_AttributeContainer) => void)): { $ret: null; $out: { "selection": AttributedTextSelection } }
Swift declarationmutating func transformAttributes<E>(in selection: inout AttributedTextSelection, body: (inout AttributeContainer) throws(E) -> Void) throws(E) where E : Error
Apply a change to the attributes in the entire selection.
Applies the given `body` to the selection. Specifically, in the case of
a selection spanning one or multiple characters, the `body` is applied
to every run in the selection individually, modifying only the part of
the run that is in the selection.
In the case of an insertion point, the `body` is applied to the
attribute container defining the typing attributes. After that,
attributes that are bound to the whole paragraph or the character
immediately preceding the caret via
<doc://com.apple.documentation/documentation/foundation/attributedstring/AttributeRunBoundaries>
are applied directly to attributed string at the respective range.
Use this function to implement controls that operate on the user's
current selection. Some controls define the new value relative to the
current state of each individual run in the selection, e.g. a stepper
for the font size:
Stepper("Font Size", onIncrement: {
text.transformAttributes(in: &selection) {
$0.font = ($0.font ?? .default).scaled(by: 1.2)
}
}, onDecrement: {
text.transformAttributes(in: &selection) {
$0.font = ($0.font ?? .default).scaled(by: 1 / 1.2)
}
})
Other controls, such as toggles for boldness, italics, or underline
usually define the new value for all ranges as the opposite of the value
in the typing attributes, as defined by
``AttributedTextSelection/typingAttributes(in:)``:
Toggle("B", isOn: .init(get: {
let font = selection.typingAttributes(in: text).font ?? .default
return font.resolve(in: environment).isBold
}, set: { isBold in
text.transformAttributes(in: &selection) {
$0.font = ($0.font ?? .default).bold(isBold)
}
}))
Omit the output parameters from the call. The result contains $ret and $out, with selection inside $out.
method · iOS 26.0+transform
TypeScripttransform(selection: AttributedTextSelection, body: ((arg0: _Foundation_AttributedString) => void)): { $ret: null; $out: { "selection": AttributedTextSelection } }
Swift declarationmutating func transform<E>(updating selection: inout AttributedTextSelection, body: (inout AttributedString) throws(E) -> Void) throws(E) where E : Error
Tracks the location of the selection throughout the mutation closure,
updating the selection so it represents the same effective locations
after the mutation.
- Note: If the mutation performed does not allow for tracking to succeed
(such as replacing the provided inout variable with an entirely
different `AttributedString`), the selection is reset to the fallback
location at the end of the text.
- Parameters:
- selection: The selection to track throughout the `body` closure.
- body: A mutating operation, or set of operations, to perform on the
value of `self`. The value of `self` is provided to the closure as an
`inout AttributedString` that the closure should mutate directly. Do
not capture the value of `self` in the provided closure - the closure
should mutate the provided `inout` copy.
Omit the output parameters from the call. The result contains $ret and $out, with selection inside $out.
subscript · iOS 26.0+subscript
TypeScriptsubscript(selection: AttributedTextSelection): _Foundation_DiscontiguousAttributedSubstring
Swift declarationsubscript(selection: AttributedTextSelection) -> DiscontiguousAttributedSubstring { get }
Obtain the discontiguous substring of a selection.
In the case of an insertion point, this substring is empty. Otherwise,
the substring contains all selected characters.
get · iOS 13.0+state
TypeScriptget state(): GestureState<unknown>
Swift declarationvar state: GestureState<State>
A value that changes as the user performs the gesture.
set · iOS 13.0+state
TypeScriptset state(value: GestureState<unknown>)
Swift declarationvar state: GestureState<State>
A value that changes as the user performs the gesture.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore(wrappedValue: string, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<string>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == URL
Creates a property that can read and write to a url user default.
- Parameters:
- wrappedValue: The default value if a url value is not specified for
the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore76520(wrappedValue: ArrayBuffer, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<ArrayBuffer>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Data
Creates a property that can read and write to a user default as data.
Avoid storing large data blobs in user defaults, such as image data,
as it can negatively affect performance of your app. On tvOS, a
`NSUserDefaultsSizeLimitExceededNotification` notification is posted
if the total user default size reaches 512kB.
- Parameters:
- wrappedValue: The default value if a data value is not specified for
the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 18.0+init
TypeScriptstatic initWrappedValueStore61228(wrappedValue: globalThis.Date, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<globalThis.Date>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Date
Creates a property that can read and write to a date user default.
- Parameters:
- wrappedValue: The default value if a date value is not specified for
the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 18.0+init
TypeScriptstatic initWrappedValueStore19462(wrappedValue: ToolbarLabelStyle, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<ToolbarLabelStyle>
Swift declarationinit(wrappedValue: Value = ToolbarLabelStyle.automatic, _ key: String, store: UserDefaults? = nil) where Value == ToolbarLabelStyle
Creates a property that can save and restore a toolbarLabelStyle state.
- Parameters:
- wrappedValue: The default value if toolbarLabelStyle state is not
available for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 18.0+init
TypeScriptstatic initWrappedValueStore81153(wrappedValue: TabViewCustomization, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<TabViewCustomization>
Swift declarationinit(wrappedValue: Value = TabViewCustomization(), _ key: String, store: UserDefaults? = nil) where Value == TabViewCustomization
Creates a property that can save and restore tab sidebar customizations.
You can set this customization on the TabView using
``View/tabViewCustomization(_:)``.
- Parameters:
- wrappedValue: The default value if the customization is not
available for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore47224(wrappedValue: string, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<string>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == String
Creates a property that can read and write to a string user default.
- Parameters:
- wrappedValue: The default value if a string value is not specified
for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore6643(wrappedValue: boolean, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<boolean>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Bool
Creates a property that can read and write to a boolean user default.
- Parameters:
- wrappedValue: The default value if a boolean value is not specified
for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore28873(wrappedValue: number, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<number>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Double
Creates a property that can read and write to a double user default.
- Parameters:
- wrappedValue: The default value if a double value is not specified
for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValueStore64522(wrappedValue: number, key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<number>
Swift declarationinit(wrappedValue: Value, _ key: String, store: UserDefaults? = nil) where Value == Int
Creates a property that can read and write to an integer user default.
- Parameters:
- wrappedValue: The default value if an integer value is not specified
for the given key.
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
get · iOS 14.0+wrappedValue
TypeScriptget wrappedValue(): unknown
Swift declarationvar wrappedValue: Value { get nonmutating set }
set · iOS 14.0+wrappedValue
TypeScriptset wrappedValue(value: unknown)
Swift declarationvar wrappedValue: Value { get nonmutating set }
get · iOS 14.0+projectedValue
TypeScriptget projectedValue(): _SwiftUICore_Binding<unknown>
Swift declarationvar projectedValue: Binding<Value> { get }
init · iOS 14.0+init
TypeScriptstatic initStore(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(string) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == URL?
Creates a property that can read and write an Optional URL user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initStore27961(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(ArrayBuffer) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == Data?
Creates a property that can read and write an Optional data user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 18.0+init
TypeScriptstatic initStore93821(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(globalThis.Date) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == Date?
Creates a property that can read and write an Optional Date user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initStore81156(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(string) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == String?
Creates a property that can read and write an Optional string user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initStore67225(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(boolean) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == Bool?
Creates a property that can read and write an Optional boolean user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initStore8511(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(number) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == Double?
Creates a property that can read and write an Optional double user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initStore56582(key: string, store?: (_Foundation_UserDefaults) | null): AppStorage<(number) | null>
Swift declarationinit(_ key: String, store: UserDefaults? = nil) where Value == Int?
Creates a property that can read and write an Optional integer user
default.
Defaults to nil if there is no restored value.
- Parameters:
- key: The key to read and write the value to in the user defaults
store.
- store: The user defaults store to read and write to. A value
of `nil` will use the user default store from the environment.
init · iOS 15.0+init
TypeScriptstatic initUrlScale(url?: (string) | null, scale?: number): AsyncImage<_SwiftUICore_Image>
Swift declarationnonisolated init(url: URL?, scale: CGFloat = 1) where Content == Image
Loads and displays an image from the specified URL.
Until the image loads, SwiftUI displays a default placeholder. When
the load operation completes successfully, SwiftUI updates the
view to show the loaded image. If the operation fails, SwiftUI
continues to display the placeholder. The following example loads
and displays an icon from an example server:
AsyncImage(url: URL(string: "https://example.com/icon.png"))
If you want to customize the placeholder or apply image-specific
modifiers --- like ``Image/resizable(capInsets:resizingMode:)`` ---
to the loaded image, use the ``init(url:scale:content:placeholder:)``
initializer instead.
- Parameters:
- url: The URL of the image to display.
- scale: The scale to use for the image. The default is `1`. Set a
different value when loading images designed for higher resolution
displays. For example, set a value of `2` for an image that you
would name with the `@2x` suffix if stored in a file on disk.
init · iOS 27.0+init
TypeScriptstatic initRequestScale(request: _Foundation_URLRequest, scale?: number): AsyncImage<_SwiftUICore_Image>
Swift declarationnonisolated init(request: URLRequest, scale: CGFloat = 1) where Content == Image
Loads and displays an image from the specified URL load request.
Until the image loads, SwiftUI displays a default placeholder. When
the load operation completes successfully, SwiftUI updates the
view to show the loaded image. If the operation fails, SwiftUI
continues to display the placeholder. The following example loads
and displays an icon from an example server:
AsyncImage(request: URLRequest(url: imageURL))
If you want to customize the placeholder or apply image-specific
modifiers --- like ``Image/resizable(capInsets:resizingMode:)`` ---
to the loaded image, use the
``init(request:scale:content:placeholder:)`` initializer instead.
- Parameters:
- request: The
<doc://com.apple.documentation/documentation/foundation/urlrequest>
of the image to display.
- scale: The scale to use for the image. The default is `1`. Set a
different value when loading images designed for higher resolution
displays. For example, set a value of `2` for an image that you
would name with the `@2x` suffix if stored in a file on disk.
init · iOS 16.0+init
TypeScriptstatic initSelectionDisplayedComponents(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<globalThis.Date>, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` with an unbounded range.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionDisplayedComponents73492(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<globalThis.Date>, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` with an unbounded range.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionDisplayedComponents71804(title: string, selection: _SwiftUICore_Binding<globalThis.Date>, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date]) where S : StringProtocol
Creates an instance that selects a `Date` within the given range.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date value being displayed and selected.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 16.0+init
TypeScriptstatic initSelectionInDisplayedComponents(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Date>, in range: ClosedRange<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` in a closed range.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The inclusive range of selectable dates.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 16.0+init
TypeScriptstatic initSelectionInDisplayedComponents56805(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Date>, in range: PartialRangeFrom<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` on or after some start date.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The open range from some selectable start date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 16.0+init
TypeScriptstatic initSelectionInDisplayedComponents31303(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Date>, in range: PartialRangeThrough<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` on or before some end date.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The open range before some selectable end date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents74860(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Date>, in range: ClosedRange<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` in a closed range.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The inclusive range of selectable dates.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents29051(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Date>, in range: PartialRangeFrom<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` on or after some start date.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The open range from some selectable start date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents2613(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Date>, in range: PartialRangeThrough<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date])
Creates an instance that selects a `Date` on or before some end date.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date value being displayed and selected.
- range: The open range before some selectable end date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents27492(title: string, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Date>, in range: ClosedRange<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date]) where S : StringProtocol
Creates an instance that selects a `Date` in a closed range.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date value being displayed and selected.
- range: The inclusive range of selectable dates.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents37443(title: string, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Date>, in range: PartialRangeFrom<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date]) where S : StringProtocol
Creates an instance that selects a `Date` on or after some start date.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date value being displayed and selected.
- range: The open range from some selectable start date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 13.0+init
TypeScriptstatic initSelectionInDisplayedComponents34807(title: string, selection: _SwiftUICore_Binding<globalThis.Date>, range: SDKHandle, displayedComponents?: DatePickerComponents): DatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Date>, in range: PartialRangeThrough<Date>, displayedComponents: DatePicker<Label>.Components = [.hourAndMinute, .date]) where S : StringProtocol
Creates an instance that selects a `Date` on or before some end date.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date value being displayed and selected.
- range: The open range before some selectable end date.
- displayedComponents: The date components that user is able to
view and edit. Defaults to `[.hourAndMinute, .date]`. On watchOS,
if `.hourAndMinute` or `.hourMinuteAndSecond` are included with
`.date`, only `.date` is displayed.
init · iOS 14.0+init
TypeScriptstatic init(nsEdgeInsets: { top: number; leading: number; bottom: number; trailing: number }): _SwiftUICore_EdgeInsets
Swift declarationinit(_ nsEdgeInsets: NSDirectionalEdgeInsets)
Create edge insets from the equivalent NSDirectionalEdgeInsets.
get · iOS 15.0+wrappedValue
TypeScriptget wrappedValue(): number
Swift declarationvar wrappedValue: Value { get nonmutating set }
The current state value, taking into account whatever bindings might be
in effect due to the current location of focus.
When focus is not in any view that is bound to this state, the wrapped
value will be `nil` (for optional-typed state) or `false` (for `Bool`-
typed state).
set · iOS 15.0+wrappedValue
TypeScriptset wrappedValue(value: number)
Swift declarationvar wrappedValue: Value { get nonmutating set }
The current state value, taking into account whatever bindings might be
in effect due to the current location of focus.
When focus is not in any view that is bound to this state, the wrapped
value will be `nil` (for optional-typed state) or `false` (for `Bool`-
typed state).
get · iOS 15.0+projectedValue
TypeScriptget projectedValue(): FocusState_Binding<number>
Swift declarationvar projectedValue: FocusState<Value>.Binding { get }
A projection of the focus state value that returns a binding.
When focus is outside any view that is bound to this state, the wrapped
value is `nil` for optional-typed state or `false` for Boolean state.
In the following example of a simple navigation sidebar, when the user
presses the Filter Sidebar Contents button, focus moves to the sidebar's
filter text field. Conversely, if the user moves focus to the sidebar's
filter manually, then the value of `isFiltering` automatically
becomes `true`, and the sidebar view updates.
struct Sidebar: View {
@State private var filterText = ""
@FocusState private var isFiltering: Bool
var body: some View {
VStack {
Button("Filter Sidebar Contents") {
isFiltering = true
}
TextField("Filter", text: $filterText)
.focused($isFiltering)
}
}
}
get · iOS 15.0+wrappedValue
TypeScriptget wrappedValue(): number
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the bound property.
set · iOS 15.0+wrappedValue
TypeScriptset wrappedValue(value: number)
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the bound property.
get · iOS 15.0+projectedValue
TypeScriptget projectedValue(): FocusState_Binding<number>
Swift declarationvar projectedValue: FocusState<Value>.Binding { get }
A projection of the binding value that returns a binding.
Use the projected value to pass a binding value down a view
hierarchy.
init · iOS 15.0+init
TypeScriptstatic init(): FocusState<boolean>
Swift declarationinit() where Value == Bool
Creates a focus state that binds to a Boolean.
init · iOS 15.0+init
TypeScriptstatic init79870(): FocusState<(number) | null>
Swift declarationinit<T>() where Value == T?, T : Hashable
Creates a focus state that binds to an optional type.
get · iOS 13.0+showsIndicators
TypeScriptget showsIndicators(): boolean
Swift declarationnonisolated var showsIndicators: Bool { get set }
A value that indicates whether the scroll view displays the scrollable
component of the content offset, in a way that's suitable for the
platform.
The default is `true`.
set · iOS 13.0+showsIndicators
TypeScriptset showsIndicators(value: boolean)
Swift declarationnonisolated var showsIndicators: Bool { get set }
A value that indicates whether the scroll view displays the scrollable
component of the content offset, in a way that's suitable for the
platform.
The default is `true`.
get · iOS 13.0+axes
TypeScriptget axes(): _SwiftUICore_Axis_Set
Swift declarationnonisolated var axes: Axis.Set { get set }
The scrollable axes of the scroll view.
The default value is ``Axis/vertical``.
set · iOS 13.0+axes
TypeScriptset axes(value: _SwiftUICore_Axis_Set)
Swift declarationnonisolated var axes: Axis.Set { get set }
The scrollable axes of the scroll view.
The default value is ``Axis/vertical``.
get · iOS 13.0+content
TypeScriptget content(): SDKHandle
Swift declarationvar content: Content
The scroll view's content.
set · iOS 13.0+content
TypeScriptset content(value: SDKHandle)
Swift declarationvar content: Content
The scroll view's content.
get · iOS 26.0+id
TypeScriptget id(): SliderTick_ID<number>
Swift declarationvar id: SliderTick<V>.ID { get }
The identity of a tick, which is derived from its value.
get · iOS 26.0+body
TypeScriptget body(): Array<SliderTick<number>>
Swift declarationvar body: SliderTick<V>.Body { get }
The value of this type's content.
init · iOS 26.0+init
TypeScriptstatic init(titleResource: _Foundation_LocalizedStringResource, value: number): SliderTick<number>
Swift declarationinit(_ titleResource: LocalizedStringResource, _ value: V)
Create a slider tick with a label from a localized string resource.
init · iOS 26.0+init
TypeScriptstatic init5691(titleKey: _SwiftUICore_LocalizedStringKey, value: number): SliderTick<number>
Swift declarationinit(_ titleKey: LocalizedStringKey, _ value: V)
Create a slider tick with a label from a localized string key.
init · iOS 26.0+init
TypeScriptstatic init96709(title: string, value: number): SliderTick<number>
Swift declarationinit<S>(_ title: S, _ value: V) where S : StringProtocol
Create a slider tick with a label from a string title.
init · iOS 26.0+init
TypeScriptstatic init99406(value: number): SliderTick<number>
Swift declarationinit(_ value: V)
Create a labeled slider tick at a specific value.
init · iOS 16.0+init
TypeScriptstatic initSelectionSupportsOpacity(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<_SwiftUICore_Color>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Color>, supportsOpacity: Bool = true)
Creates a color picker with a text label generated from a title string
resource.
Use ``ColorPicker`` to create a color well that your app uses to allow
the selection of a ``Color``. The example below creates a color well
using a ``Binding`` to a property stored in a settings object and title
you provide:
final class Settings: ObservableObject {
@Published var alignmentGuideColor =
Color(.sRGB, red: 0.98, green: 0.9, blue: 0.2)
}
struct FormattingControls: View {
@State private var settings = Settings()
var body: some View {
VStack {
// Other formatting controls.
ColorPicker("Alignment Guides",
selection: $settings.alignmentGuideColor
)
}
}
}
- Parameters:
- titleResource: The localized title of the picker.
- selection: A ``Binding`` to the variable that displays the
selected ``Color``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 16.0+init
TypeScriptstatic initSelectionSupportsOpacity85758(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<_CoreGraphics_CGColor>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<CGColor>, supportsOpacity: Bool = true)
Creates a color picker with a text label generated from a title string
resource.
- Parameters:
- titleResource: The localized title of the picker.
- selection: A ``Binding`` to the variable that displays the
selected ``CGColor``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 14.0+init
TypeScriptstatic initSelectionSupportsOpacity99584(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<_SwiftUICore_Color>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Color>, supportsOpacity: Bool = true)
Creates a color picker with a text label generated from a title string key.
Use ``ColorPicker`` to create a color well that your app uses to allow
the selection of a ``Color``. The example below creates a color well
using a ``Binding`` to a property stored in a settings object and title
you provide:
final class Settings: ObservableObject {
@Published var alignmentGuideColor =
Color(.sRGB, red: 0.98, green: 0.9, blue: 0.2)
}
struct FormattingControls: View {
@State private var settings = Settings()
var body: some View {
VStack {
// Other formatting controls.
ColorPicker("Alignment Guides",
selection: $settings.alignmentGuideColor
)
}
}
}
- Parameters:
- titleKey: The key for the localized title of the picker.
- selection: A ``Binding`` to the variable that displays the
selected ``Color``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 14.0+init
TypeScriptstatic initSelectionSupportsOpacity84113(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<_CoreGraphics_CGColor>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<CGColor>, supportsOpacity: Bool = true)
Creates a color picker with a text label generated from a title string key.
- Parameters:
- titleKey: The key for the localized title of the picker.
- selection: A ``Binding`` to the variable that displays the
selected ``CGColor``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 14.0+init
TypeScriptstatic initSelectionSupportsOpacity54936(title: string, selection: _SwiftUICore_Binding<_SwiftUICore_Color>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Color>, supportsOpacity: Bool = true) where S : StringProtocol
Creates a color picker with a text label generated from a title string.
Use ``ColorPicker`` to create a color well that your app uses to allow
the selection of a ``Color``. The example below creates a color well
using a ``Binding`` and title you provide:
func showColorPicker(_ title: String, color: Binding<Color>) {
ColorPicker(title, selection: color)
}
- Parameters:
- title: The title displayed by the color picker.
- selection: A ``Binding`` to the variable containing a ``Color``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 14.0+init
TypeScriptstatic initSelectionSupportsOpacity18447(title: string, selection: _SwiftUICore_Binding<_CoreGraphics_CGColor>, supportsOpacity?: boolean): ColorPicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<CGColor>, supportsOpacity: Bool = true) where S : StringProtocol
Creates a color picker with a text label generated from a title string.
- Parameters:
- title: The title displayed by the color picker.
- selection: A ``Binding`` to the variable containing a ``CGColor``.
- supportsOpacity: A Boolean value that indicates whether the color
picker allows adjustments to the selected color's opacity; the
default is `true`.
init · iOS 14.0+init
TypeScriptinit(uiUserInterfaceStyle: _UIKit_UIUserInterfaceStyle): (_SwiftUICore_ColorScheme) | null
Swift declarationinit?(_ uiUserInterfaceStyle: UIUserInterfaceStyle)
Creates a color scheme from its user interface style equivalent.
get · iOS 16.0+all
TypeScriptget all(): EditActions<unknown>
Swift declarationstatic var all: EditActions<Data> { get }
All the edit actions available on this collection.
init · iOS 16.0+init
TypeScriptinit(rawValue: number): EditActions<unknown>
Swift declarationinit(rawValue: Int)
Creates a new set from a raw value.
- Parameter rawValue: The raw value with which to create the
collection edits.
get · iOS 16.0+rawValue
TypeScriptgetRawValue($self: EditActions): number
Swift declarationlet rawValue: Int
The raw value.
init · iOS 16.0+init
TypeScriptstatic initTextPrompt(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): SecureField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, prompt: Text?)
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- titleResource: Text resource for the field's localized title. The
title describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
- prompt: A ``Text`` view that represents the secure field's prompt.
The prompt provides guidance on what people should type into the
secure field.
init · iOS 15.0+init
TypeScriptstatic initTextPrompt10433(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): SecureField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, prompt: Text?)
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- titleKey: The key for the field's localized title. The title
describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
- prompt: A ``Text`` view that represents the secure field's prompt.
The prompt provides guidance on what people should type into the
secure field.
init · iOS 15.0+init
TypeScriptstatic initTextPrompt45231(title: string, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): SecureField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, prompt: Text?) where S : StringProtocol
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- title: A string that describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
- prompt: A ``Text`` view that represents the secure field's prompt.
The prompt provides guidance on what people should type into the
secure field.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnCommit(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, onCommit: (() => void)): SecureField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, onCommit: @escaping () -> Void)
Creates an instance.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- text: The text to display and edit.
- onCommit: The action to perform when the user performs an action
(usually pressing the Return key) while the secure field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnCommit45604(title: string, text: _SwiftUICore_Binding<string>, onCommit: (() => void)): SecureField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, onCommit: @escaping () -> Void) where S : StringProtocol
Creates an instance.
- Parameters:
- title: The title of `self`, describing its purpose.
- text: The text to display and edit.
- onCommit: The action to perform when the user performs an action
(usually pressing the Return key) while the secure field has focus.
init · iOS 16.0+init
TypeScriptstatic initText(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>): SecureField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>)
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- titleResource: Text resource for the field's localized title. The
title describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
init · iOS 13.0+init
TypeScriptstatic initText18553(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>): SecureField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>)
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- titleKey: The key for the field's localized title. The title
describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
init · iOS 13.0+init
TypeScriptstatic initText16995(title: string, text: _SwiftUICore_Binding<string>): SecureField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S>(_ title: S, text: Binding<String>) where S : StringProtocol
Creates a secure field with a prompt generated from a `Text`.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever someone submits this secure field --- for example, by
pressing the Return key.
- Parameters:
- title: A string that describes the purpose of the field.
- text: A binding to the text that the field displays and edits.
method · iOS 16.0+width
TypeScriptwidthMinIdealMax(min?: (number) | null, ideal?: (number) | null, max?: (number) | null): TableColumn<SDKHandle, SDKHandle, SDKHandle, SDKHandle>
Swift declarationnonisolated func width(min: CGFloat? = nil, ideal: CGFloat? = nil, max: CGFloat? = nil) -> TableColumn<RowValue, Sort, Content, Label>
Creates a resizable table column with the provided constraints.
Always specify at least one width constraint when calling this method.
Pass `nil` or leave out a constraint to indicate no change to the
sizing of a column.
To create a fixed size column use ``SwiftUI/TableColumn/width(_:)``
instead.
- Parameters:
- min: The minimum width of a resizable column. If non-`nil`, the
value must be greater than or equal to `0`.
- ideal: The ideal width of the column, used to determine the initial
width of the table column. The column always starts at least as
large as the set ideal size, but may be larger if table was sized
larger than the ideal of all of its columns.
- max: The maximum width of a resizable column. If non-`nil`, the
value must be greater than `0`. Pass
<doc://com.apple.documentation/documentation/swift/floatingpoint/infinity>
to indicate unconstrained maximum width.
method · iOS 16.0+width
TypeScriptwidth(): TableColumn<SDKHandle, SDKHandle, SDKHandle, SDKHandle>
Swift declaration@export(implementation) nonisolated func width() -> TableColumn<RowValue, Sort, Content, Label>
Does not change the table column's width.
Use ``SwiftUI/TableColumn/width(_:)`` or
``SwiftUI/TableColumn/width(min:ideal:max:)`` instead.
method · iOS 16.0+width
TypeScriptwidth57743(width?: (number) | null): TableColumn<SDKHandle, SDKHandle, SDKHandle, SDKHandle>
Swift declarationnonisolated func width(_ width: CGFloat? = nil) -> TableColumn<RowValue, Sort, Content, Label>
Creates a fixed width table column that isn't user resizable.
- Parameter width: A fixed width for the resulting column. If `width`
is `nil`, the resulting column has no change in sizing.
get · iOS 14.0+id
TypeScriptget id(): number
Swift declarationnonisolated var id: ID { get }
The stable identity of the entity associated with this instance.
get · iOS 17.0+dismissBehavior
TypeScriptget dismissBehavior(): DismissBehavior
Swift declarationvar dismissBehavior: DismissBehavior { get set }
The behavior for how windows will dismiss programmatically when used in
conjunction with ``DismissWindowAction``.
The default value is `.interactive`.
You can use this property to dismiss windows which may be showing a
modal presentation by using the `.destructive` value:
struct DismissWindowButton: View {
@Environment(\.dismissWindow) private var dismissWindow
var body: some View {
Button("Close Auxiliary Window") {
withTransaction(\.dismissBehavior, .destructive) {
dismissWindow(id: "auxiliary")
}
}
}
}
set · iOS 17.0+dismissBehavior
TypeScriptset dismissBehavior(value: DismissBehavior)
Swift declarationvar dismissBehavior: DismissBehavior { get set }
The behavior for how windows will dismiss programmatically when used in
conjunction with ``DismissWindowAction``.
The default value is `.interactive`.
You can use this property to dismiss windows which may be showing a
modal presentation by using the `.destructive` value:
struct DismissWindowButton: View {
@Environment(\.dismissWindow) private var dismissWindow
var body: some View {
Button("Close Auxiliary Window") {
withTransaction(\.dismissBehavior, .destructive) {
dismissWindow(id: "auxiliary")
}
}
}
}
static · iOS 17.5+buildLimitedAvailability
TypeScriptstatic buildLimitedAvailability(content: SDKHandle): SDKHandle
Swift declaration@export(implementation) static func buildLimitedAvailability(_ content: any CustomizableToolbarContent) -> some CustomizableToolbarContent
init · iOS 15.0+init
TypeScriptstatic init(configuration: ControlGroupStyleConfiguration): ControlGroup<ControlGroupStyleConfiguration_Content>
Swift declarationnonisolated init(_ configuration: ControlGroupStyleConfiguration)
Creates a control group based on a style configuration.
Use this initializer within the
``ControlGroupStyle/makeBody(configuration:)`` method of a
``ControlGroupStyle`` instance to create an instance of the control group
being styled. This is useful for custom control group styles that modify
the current control group style.
For example, the following code creates a new, custom style that places a
red border around the current control group:
struct RedBorderControlGroupStyle: ControlGroupStyle {
func makeBody(configuration: Configuration) -> some View {
ControlGroup(configuration)
.border(Color.red)
}
}
get · iOS 15.0+sortDescriptors
TypeScriptget sortDescriptors(): Promise<Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get set }
The request's sort descriptors, accessed as value types.
Set this configuration value to cause a ``FetchRequest`` to execute a
fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``FetchRequest/Configuration/nsSortDescriptors`` instead.
Access this value of a ``FetchRequest/Configuration`` structure for
a given request by using the ``FetchedResults/sortDescriptors``
property on the associated ``FetchedResults`` instance, either
directly or through a ``Binding``.
set · iOS 15.0+sortDescriptors
TypeScriptsetSortDescriptors(value: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>): Promise<void>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get set }
The request's sort descriptors, accessed as value types.
Set this configuration value to cause a ``FetchRequest`` to execute a
fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``FetchRequest/Configuration/nsSortDescriptors`` instead.
Access this value of a ``FetchRequest/Configuration`` structure for
a given request by using the ``FetchedResults/sortDescriptors``
property on the associated ``FetchedResults`` instance, either
directly or through a ``Binding``.
init · iOS 15.0+init
TypeScriptstatic initSortDescriptorsPredicateAnimation(sortDescriptors: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>, predicate?: (_Foundation_NSPredicate) | null, animation?: (_SwiftUICore_Animation) | null): Promise<FetchRequest<_CoreData_NSManagedObject>>
Swift declaration@MainActor @preconcurrency init(sortDescriptors: [SortDescriptor<Result>], predicate: NSPredicate? = nil, animation: Animation? = nil)
Creates a fetch request based on a predicate and value type sort
parameters.
The request gets the entity type from the `Result` instance by calling
that managed object's
<doc://com.apple.documentation/documentation/CoreData/NSManagedObject/entity()>
type method. If you need to specify the entity type explicitly, use the
``init(entity:sortDescriptors:predicate:animation:)`` initializer
instead. If you need more control over the fetch request configuration,
use ``init(fetchRequest:animation:)``.
- Parameters:
- sortDescriptors: An array of sort descriptors that define the sort
order of the fetched results.
- predicate: An
<doc://com.apple.documentation/documentation/Foundation/NSPredicate>
instance that defines logical conditions used to filter the fetched
results.
- animation: The animation to use for user interface changes that
result from changes to the fetched results.
init · iOS 13.0+init
TypeScriptstatic initSortDescriptorsPredicateAnimation29941(sortDescriptors: Array<_Foundation_NSSortDescriptor>, predicate?: (_Foundation_NSPredicate) | null, animation?: (_SwiftUICore_Animation) | null): Promise<FetchRequest<_CoreData_NSManagedObject>>
Swift declaration@MainActor @preconcurrency init(sortDescriptors: [NSSortDescriptor], predicate: NSPredicate? = nil, animation: Animation? = nil)
Creates a fetch request based on a predicate and reference type sort
parameters.
The request gets the entity type from the `Result` instance by calling
that managed object's
<doc://com.apple.documentation/documentation/CoreData/NSManagedObject/entity()>
type method. If you need to specify the entity type explicitly, use the
``init(entity:sortDescriptors:predicate:animation:)`` initializer
instead. If you need more control over the fetch request configuration,
use ``init(fetchRequest:animation:)``.
- Parameters:
- sortDescriptors: An array of sort descriptors that define the sort
order of the fetched results.
- predicate: An
<doc://com.apple.documentation/documentation/Foundation/NSPredicate>
instance that defines logical conditions used to filter the fetched
results.
- animation: The animation to use for user interface changes that
result from changes to the fetched results.
get · iOS 14.0+wrappedValue
TypeScriptget wrappedValue(): (unknown) | null
Swift declarationvar wrappedValue: Value? { get }
The value for the focus key given the current scope and state of the
focused view hierarchy.
Returns `nil` when nothing in the focused view hierarchy exports a
value.
init · iOS 14.0+init
TypeScriptstatic init(keyPath: SDKHandle): FocusedValue<unknown>
Swift declarationinit(_ keyPath: KeyPath<FocusedValues, Value?>)
A new property wrapper for the given key path.
The value of the property wrapper is updated dynamically as focus
changes and different published values go in and out of scope.
- Parameter keyPath: The key path for the focus value to read.
init · iOS 13.0+init
TypeScriptstatic initInitialValueResetTransaction(initialValue: unknown, resetTransaction: _SwiftUICore_Transaction): GestureState<unknown>
Swift declaration@export(implementation) init(initialValue: Value, resetTransaction: Transaction)
Creates a view state that's derived from a gesture with an initial state
value and a transaction to reset it.
- Parameters:
- initialValue: An initial state value.
- resetTransaction: A transaction that provides metadata for view
updates.
init · iOS 13.0+init
TypeScriptstatic initInitialValueReset(initialValue: unknown, reset: ((arg0: unknown, arg1: _SwiftUICore_Transaction) => void)): GestureState<unknown>
Swift declaration@export(implementation) init(initialValue: Value, reset: @escaping (Value, inout Transaction) -> Void)
Creates a view state that's derived from a gesture with an initial state
value and a closure that provides a transaction to reset it.
- Parameters:
- initialValue: An initial state value.
- reset: A closure that provides a ``Transaction``.
init · iOS 13.0+init
TypeScriptstatic initInitialValue(initialValue: unknown): GestureState<unknown>
Swift declaration@export(implementation) init(initialValue: Value)
Creates a view state that's derived from a gesture with an initial
value.
- Parameter initialValue: An initial value for the gesture state
property.
init · iOS 13.0+init
TypeScriptstatic initWrappedValueResetTransaction(wrappedValue: unknown, resetTransaction: _SwiftUICore_Transaction): GestureState<unknown>
Swift declarationinit(wrappedValue: Value, resetTransaction: Transaction)
Creates a view state that's derived from a gesture with a wrapped state
value and a transaction to reset it.
- Parameters:
- wrappedValue: A wrapped value for the gesture state property.
- resetTransaction: A transaction that provides metadata for view
updates.
init · iOS 13.0+init
TypeScriptstatic initWrappedValueReset(wrappedValue: unknown, reset: ((arg0: unknown, arg1: _SwiftUICore_Transaction) => void)): GestureState<unknown>
Swift declarationinit(wrappedValue: Value, reset: @escaping (Value, inout Transaction) -> Void)
Creates a view state that's derived from a gesture with a wrapped state
value and a closure that provides a transaction to reset it.
- Parameters:
- wrappedValue: A wrapped value for the gesture state property.
- reset: A closure that provides a ``Transaction``.
init · iOS 13.0+init
TypeScriptstatic initWrappedValue(wrappedValue: unknown): GestureState<unknown>
Swift declarationinit(wrappedValue: Value)
Creates a view state that's derived from a gesture.
- Parameter wrappedValue: A wrapped value for the gesture state
property.
get · iOS 13.0+wrappedValue
TypeScriptget wrappedValue(): unknown
Swift declarationvar wrappedValue: Value { get }
The wrapped value referenced by the gesture state property.
get · iOS 13.0+projectedValue
TypeScriptget projectedValue(): GestureState<unknown>
Swift declarationvar projectedValue: GestureState<Value> { get }
A binding to the gesture state property.
init · iOS 14.0+init
TypeScriptstatic initValueTotal(value?: (number) | null, total?: number): ProgressView<_SwiftUICore_EmptyView, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<V>(value: V?, total: V = 1.0) where Label == EmptyView, CurrentValueLabel == EmptyView, V : BinaryFloatingPoint
Creates a progress view for showing determinate progress.
If the value is non-`nil`, but outside the range of `0.0` through
`total`, the progress view pins the value to those limits, rounding to
the nearest possible bound. A value of `nil` represents indeterminate
progress, in which case the progress view ignores `total`.
- Parameters:
- value: The completed amount of the task to this point, in a range
of `0.0` to `total`, or `nil` if the progress is indeterminate.
- total: The full amount representing the complete scope of the
task, meaning the task is complete if `value` equals `total`. The
default value is `1.0`.
init · iOS 14.0+init
TypeScriptstatic init(): ProgressView<_SwiftUICore_EmptyView, _SwiftUICore_EmptyView>
Swift declarationnonisolated init() where Label == EmptyView
Creates a progress view for showing indeterminate progress, without a
label.
init · iOS 16.0+init
TypeScriptstatic init99443(titleResource: _Foundation_LocalizedStringResource): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource) where Label == Text
Creates a progress view for showing indeterminate progress that
generates its label from a localized string resource.
This initializer creates a ``Text`` view on your behalf. See
``Text`` for more information about localizing strings. To initialize a
indeterminate progress view with a string variable, use
the corresponding initializer that takes a `StringProtocol` instance.
- Parameters:
- titleResource: Text resource for the progress view's localized
title that describes the task in progress.
init · iOS 14.0+init
TypeScriptstatic init68874(titleKey: _SwiftUICore_LocalizedStringKey): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey) where Label == Text
Creates a progress view for showing indeterminate progress that
generates its label from a localized string.
This initializer creates a ``Text`` view on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
``Text`` for more information about localizing strings. To initialize a
indeterminate progress view with a string variable, use
the corresponding initializer that takes a `StringProtocol` instance.
- Parameters:
- titleKey: The key for the progress view's localized title that
describes the task in progress.
init · iOS 14.0+init
TypeScriptstatic init37513(title: string): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<S>(_ title: S) where Label == Text, S : StringProtocol
Creates a progress view for showing indeterminate progress that
generates its label from a string.
- Parameters:
- title: A string that describes the task in progress.
This initializer creates a ``Text`` view on your behalf, and treats the
title similar to ``Text/init(verbatim:)``. See ``Text`` for more
information about localizing strings. To initialize a progress view with
a localized string key, use the corresponding initializer that takes a
`LocalizedStringKey` instance.
init · iOS 16.0+init
TypeScriptstatic initTimerIntervalCountsDown(timerInterval: SDKHandle, countsDown?: boolean): ProgressView<_SwiftUICore_EmptyView, DefaultDateProgressLabel>
Swift declarationnonisolated init(timerInterval: ClosedRange<Date>, countsDown: Bool = true)
Creates a progress view for showing continuous progress as time passes.
Use this initializer to create a view that shows continuous progress
within a date range. The following example initializes a progress view
with a range of `start...end`, where `start` is 30 seconds in the past
and `end` is 90 seconds in the future. As a result, the progress view
begins at 25 percent complete.
struct ContentView: View {
let start = Date().addingTimeInterval(-30)
let end = Date().addingTimeInterval(90)
var body: some View {
ProgressView(timerInterval: start...end
countsDown: false)
}
}

By default, the progress view empties as time passes from the start of
the date range to the end, but you can use the `countsDown` parameter to
create a progress view that fills as time passes, as the above example
demonstrates.
The progress view provided by this initializer omits a descriptive
label and provides a text label that automatically updates to describe
the current time remaining. To provide custom views for these labels,
use ``init(value:total:label:currentValueLabel:)`` instead.
> Note: Date-relative progress views, such as those created with this
initializer, don't support custom styles.
- Parameters:
- timerInterval: The date range over which the view progresses.
- countsDown: If `true` (the default), the view empties as time passes.
init · iOS 16.0+init
TypeScriptstatic initValueTotal15427(titleResource: _Foundation_LocalizedStringResource, value?: (number) | null, total?: number): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declaration@export(implementation) nonisolated init<V>(_ titleResource: LocalizedStringResource, value: V?, total: V = 1.0) where Label == Text, CurrentValueLabel == EmptyView, V : BinaryFloatingPoint
Creates a progress view for showing determinate progress that generates
its label from a localized string resource.
If the value is non-`nil`, but outside the range of `0.0` through
`total`, the progress view pins the value to those limits, rounding to
the nearest possible bound. A value of `nil` represents indeterminate
progress, in which case the progress view ignores `total`.
This initializer creates a ``Text`` view on your behalf. See
``Text`` for more information about localizing strings. To initialize a
determinate progress view with a string variable, use
the corresponding initializer that takes a `StringProtocol` instance.
- Parameters:
- titleResource: Text resource for the progress view's localized
title that describes the task in progress.
- value: The completed amount of the task to this point, in a range
of `0.0` to `total`, or `nil` if the progress is
indeterminate.
- total: The full amount representing the complete scope of the
task, meaning the task is complete if `value` equals `total`. The
default value is `1.0`.
init · iOS 14.0+init
TypeScriptstatic initValueTotal54586(titleKey: _SwiftUICore_LocalizedStringKey, value?: (number) | null, total?: number): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<V>(_ titleKey: LocalizedStringKey, value: V?, total: V = 1.0) where Label == Text, CurrentValueLabel == EmptyView, V : BinaryFloatingPoint
Creates a progress view for showing determinate progress that generates
its label from a localized string.
If the value is non-`nil`, but outside the range of `0.0` through
`total`, the progress view pins the value to those limits, rounding to
the nearest possible bound. A value of `nil` represents indeterminate
progress, in which case the progress view ignores `total`.
This initializer creates a ``Text`` view on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
``Text`` for more information about localizing strings. To initialize a
determinate progress view with a string variable, use
the corresponding initializer that takes a `StringProtocol` instance.
- Parameters:
- titleKey: The key for the progress view's localized title that
describes the task in progress.
- value: The completed amount of the task to this point, in a range
of `0.0` to `total`, or `nil` if the progress is
indeterminate.
- total: The full amount representing the complete scope of the
task, meaning the task is complete if `value` equals `total`. The
default value is `1.0`.
init · iOS 14.0+init
TypeScriptstatic initValueTotal49894(title: string, value?: (number) | null, total?: number): ProgressView<_SwiftUICore_Text, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<S, V>(_ title: S, value: V?, total: V = 1.0) where Label == Text, CurrentValueLabel == EmptyView, S : StringProtocol, V : BinaryFloatingPoint
Creates a progress view for showing determinate progress that generates
its label from a string.
If the value is non-`nil`, but outside the range of `0.0` through
`total`, the progress view pins the value to those limits, rounding to
the nearest possible bound. A value of `nil` represents indeterminate
progress, in which case the progress view ignores `total`.
This initializer creates a ``Text`` view on your behalf, and treats the
title similar to ``Text/init(verbatim:)``. See ``Text`` for more
information about localizing strings. To initialize a determinate
progress view with a localized string key, use the corresponding
initializer that takes a `LocalizedStringKey` instance.
- Parameters:
- title: The string that describes the task in progress.
- value: The completed amount of the task to this point, in a range
of `0.0` to `total`, or `nil` if the progress is
indeterminate.
- total: The full amount representing the complete scope of the
task, meaning the task is complete if `value` equals `total`. The
default value is `1.0`.
init · iOS 14.0+init
TypeScriptstatic init10522(progress: _Foundation_Progress): ProgressView<_SwiftUICore_EmptyView, _SwiftUICore_EmptyView>
Swift declarationnonisolated init(_ progress: Progress) where Label == EmptyView, CurrentValueLabel == EmptyView
Creates a progress view for visualizing the given progress instance.
The progress view synthesizes a default label using the
`localizedDescription` of the given progress instance.
init · iOS 14.0+init
TypeScriptstatic init65192(configuration: ProgressViewStyleConfiguration): ProgressView<ProgressViewStyleConfiguration_Label, ProgressViewStyleConfiguration_CurrentValueLabel>
Swift declarationnonisolated init(_ configuration: ProgressViewStyleConfiguration) where Label == ProgressViewStyleConfiguration.Label, CurrentValueLabel == ProgressViewStyleConfiguration.CurrentValueLabel
Creates a progress view based on a style configuration.
You can use this initializer within the
``ProgressViewStyle/makeBody(configuration:)`` method of a
``ProgressViewStyle`` to create an instance of the styled progress view.
This is useful for custom progress view styles that only modify the
current progress view style, as opposed to implementing a brand new
style. Because this modifier style can't know how the current style
represents progress, avoid making assumptions about the view's contents,
such as whether it uses bars or other shapes.
The following example shows a style that adds a rounded pink border to a
progress view, but otherwise preserves the progress view's current
style:
struct PinkBorderedProgressViewStyle: ProgressViewStyle {
func makeBody(configuration: Configuration) -> some View {
ProgressView(configuration)
.padding(4)
.border(.pink, width: 3)
.cornerRadius(4)
}
}

- Note: Progress views in widgets don't apply custom styles.
init · iOS 18.0+init
TypeScriptstatic initWrappedValueStore(wrappedValue: TabViewCustomization, key: string, store?: (_Foundation_UserDefaults) | null): SceneStorage<TabViewCustomization>
Swift declarationinit(wrappedValue: Value = TabViewCustomization(), _ key: String, store: UserDefaults? = nil) where Value == TabViewCustomization
Creates a property that can save and restore tab sidebar customizations.
You can set this customization on the TabView using
``View/tabViewCustomization(_:)``.
The tab view customization is typically not added to
`SceneStorage`, but instead stored in `AppStorage` so the
customizations are consistent across different scenes.
- Parameter wrappedValue: The default value if the customization
is not available for the given key.
- Parameter key: a key used to save and restore the value.
- Parameter store: The user defaults store to read and write to. A
value of `nil` will use the user default store from the environment.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue(wrappedValue: string, key: string): SceneStorage<string>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == URL
Creates a property that can save and restore a URL.
- Parameter wrappedValue: The default value if a URL is not available
for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue26719(wrappedValue: ArrayBuffer, key: string): SceneStorage<ArrayBuffer>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == Data
Creates a property that can save and restore data.
Avoid storing large data blobs, such as image data, as it can negatively
affect performance of your app.
- Parameter wrappedValue: The default value if data is not available
for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 18.0+init
TypeScriptstatic initWrappedValue76643(wrappedValue: globalThis.Date, key: string): SceneStorage<globalThis.Date>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == Date
Creates a property that can save and restore a Date.
- Parameter wrappedValue: The default value if a Date is not available
for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue34599(wrappedValue: string, key: string): SceneStorage<string>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == String
Creates a property that can save and restore a string.
- Parameter wrappedValue: The default value if a string is not available
for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue3556(wrappedValue: boolean, key: string): SceneStorage<boolean>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == Bool
Creates a property that can save and restore a boolean.
- Parameter wrappedValue: The default value if a boolean is not
available for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue44130(wrappedValue: number, key: string): SceneStorage<number>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == Double
Creates a property that can save and restore a double.
- Parameter wrappedValue: The default value if a double is not available
for the given key.
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic initWrappedValue90409(wrappedValue: number, key: string): SceneStorage<number>
Swift declarationinit(wrappedValue: Value, _ key: String) where Value == Int
Creates a property that can save and restore an integer.
- Parameter wrappedValue: The default value if an integer is not
available for the given key.
- Parameter key: a key used to save and restore the value.
get · iOS 14.0+wrappedValue
TypeScriptget wrappedValue(): unknown
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the state variable.
This works identically to `State.wrappedValue`.
- SeeAlso: State.wrappedValue
set · iOS 14.0+wrappedValue
TypeScriptset wrappedValue(value: unknown)
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the state variable.
This works identically to `State.wrappedValue`.
- SeeAlso: State.wrappedValue
get · iOS 14.0+projectedValue
TypeScriptget projectedValue(): _SwiftUICore_Binding<unknown>
Swift declarationvar projectedValue: Binding<Value> { get }
A binding to the state value.
This works identically to `State.projectedValue`.
- SeeAlso: State.projectedValue
init · iOS 14.0+init
TypeScriptstatic init(key: string): SceneStorage<(string) | null>
Swift declarationinit(_ key: String) where Value == URL?
Creates a property that can save and restore an Optional URL.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic init25898(key: string): SceneStorage<(ArrayBuffer) | null>
Swift declarationinit(_ key: String) where Value == Data?
Creates a property that can save and restore an Optional data.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 18.0+init
TypeScriptstatic init68030(key: string): SceneStorage<(globalThis.Date) | null>
Swift declarationinit(_ key: String) where Value == Date?
Creates a property that can save and restore an Optional Date.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic init66157(key: string): SceneStorage<(string) | null>
Swift declarationinit(_ key: String) where Value == String?
Creates a property that can save and restore an Optional string.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic init13250(key: string): SceneStorage<(boolean) | null>
Swift declarationinit(_ key: String) where Value == Bool?
Creates a property that can save and restore an Optional boolean.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic init27288(key: string): SceneStorage<(number) | null>
Swift declarationinit(_ key: String) where Value == Double?
Creates a property that can save and restore an Optional double.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 14.0+init
TypeScriptstatic init52255(key: string): SceneStorage<(number) | null>
Swift declarationinit(_ key: String) where Value == Int?
Creates a property that can save and restore an Optional integer.
Defaults to nil if there is no restored value
- Parameter key: a key used to save and restore the value.
init · iOS 16.0+init
TypeScriptstatic initImage(titleResource: _Foundation_LocalizedStringResource, image: string): SharePreview<string, never>
Swift declaration@export(implementation) init(_ titleResource: LocalizedStringResource, image: Image)
Creates a preview representation.
- Parameters:
- titleResource: A resource for the title to show in a preview.
- image: An image to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImage74208(titleKey: _SwiftUICore_LocalizedStringKey, image: string): SharePreview<string, never>
Swift declarationinit(_ titleKey: LocalizedStringKey, image: Image)
Creates a preview representation.
- Parameters:
- titleKey: A key identifying a title to show in a preview.
- image: An image to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImage70757(title: _SwiftUICore_Text, image: string): SharePreview<string, never>
Swift declarationinit(_ title: Text, image: Image)
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- image: An image to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImage65148(title: string, image: string): SharePreview<string, never>
Swift declarationinit<S>(_ title: S, image: Image) where S : StringProtocol
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- image: An image to show in a preview.
init · iOS 16.0+init
TypeScriptstatic init(titleResource: _Foundation_LocalizedStringResource): SharePreview<never, never>
Swift declaration@export(implementation) init(_ titleResource: LocalizedStringResource)
Creates a preview representation.
- Parameters:
- titleResource: A resource for the title to show in a preview.
init · iOS 16.0+init
TypeScriptstatic init91740(titleKey: _SwiftUICore_LocalizedStringKey): SharePreview<never, never>
Swift declarationinit(_ titleKey: LocalizedStringKey)
Creates a preview representation.
- Parameters:
- titleKey: A key identifying a title to show in a preview.
init · iOS 16.0+init
TypeScriptstatic init3317(title: _SwiftUICore_Text): SharePreview<never, never>
Swift declarationinit(_ title: Text)
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
init · iOS 16.0+init
TypeScriptstatic init85892(title: string): SharePreview<never, never>
Swift declarationinit<S>(_ title: S) where S : StringProtocol
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initIcon(titleResource: _Foundation_LocalizedStringResource, icon: string): SharePreview<never, string>
Swift declaration@export(implementation) init(_ titleResource: LocalizedStringResource, icon: Icon)
Creates a preview representation.
- Parameters:
- titleResource: A resource for the title to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initIcon76522(titleKey: _SwiftUICore_LocalizedStringKey, icon: string): SharePreview<never, string>
Swift declarationinit(_ titleKey: LocalizedStringKey, icon: Icon)
Creates a preview representation.
- Parameters:
- titleKey: A key identifying a title to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initIcon23621(title: _SwiftUICore_Text, icon: string): SharePreview<never, string>
Swift declarationinit(_ title: Text, icon: Icon)
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initIcon68432(title: string, icon: string): SharePreview<never, string>
Swift declarationinit<S>(_ title: S, icon: Icon) where S : StringProtocol
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImageIcon(titleResource: _Foundation_LocalizedStringResource, image: string, icon: string): SharePreview<string, string>
Swift declaration@export(implementation) init(_ titleResource: LocalizedStringResource, image: Image, icon: Icon)
Creates a preview representation.
- Parameters:
- titleResource: A resource for the title to show in a preview.
- image: An image to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImageIcon22749(titleKey: _SwiftUICore_LocalizedStringKey, image: string, icon: string): SharePreview<string, string>
Swift declarationinit(_ titleKey: LocalizedStringKey, image: Image, icon: Icon)
Creates a preview representation.
- Parameters:
- titleKey: A key identifying a title to show in a preview.
- image: An image to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImageIcon30662(title: _SwiftUICore_Text, image: string, icon: string): SharePreview<string, string>
Swift declarationinit(_ title: Text, image: Image, icon: Icon)
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- image: An image to show in a preview.
- icon: An icon to show in a preview.
init · iOS 16.0+init
TypeScriptstatic initImageIcon4671(title: string, image: string, icon: string): SharePreview<string, string>
Swift declarationinit<S>(_ title: S, image: Image, icon: Icon) where S : StringProtocol
Creates a preview representation.
- Parameters:
- title: A title to show in a preview.
- image: An image to show in a preview.
- icon: An icon to show in a preview.
method · iOS 16.0+invalidateTimelineContent
TypeScriptinvalidateTimelineContent(): void
Swift declarationfunc invalidateTimelineContent()
Resets any pre-rendered views the system has from the timeline.
When entering Always On Display, the system might pre-render frames. If the
content of these frames must change in a way that isn't reflected by
the schedule or the timeline view's current bindings --- for example, because
the user changes the title of a future calendar event --- call this method to
request that the frames be regenerated.
get · iOS 15.0+date
TypeScriptget date(): globalThis.Date
Swift declarationlet date: Date
The date from the schedule that triggered the current view update.
The first time a ``TimelineView`` closure receives this date, it
might be in the past. For example, if you create an
``TimelineSchedule/everyMinute`` schedule at `10:09:55`, the
schedule creates entries `10:09:00`, `10:10:00`, `10:11:00`, and so
on. In response, the timeline view performs an initial update
immediately, at `10:09:55`, but the context contains the `10:09:00`
date entry. Subsequent entries arrive at their corresponding times.
get · iOS 15.0+cadence
TypeScriptget cadence(): TimelineView_Context_Cadence<SDKHandle, unknown>
Swift declarationlet cadence: TimelineView<Schedule, Content>.Context.Cadence
The rate at which the timeline updates the view.
Use this value to hide information that updates faster than the
view's current update rate. For example, you could hide the
millisecond component of a digital timer when the cadence is
anything slower than ``Cadence-swift.enum/live``.
Because the ``Cadence-swift.enum`` enumeration conforms to the
<doc://com.apple.documentation/documentation/Swift/Comparable>
protocol, you can compare cadences with relational operators.
Slower cadences have higher values, so you could perform the check
described above with the following comparison:
let hideMilliseconds = cadence > .live
get · iOS 13.0+content
TypeScriptget content(): SDKHandle
Swift declarationvar content: Content
set · iOS 13.0+content
TypeScriptset content(value: SDKHandle)
Swift declarationvar content: Content
get · iOS 16.0+uiImage
TypeScriptget uiImage(): Promise<(_UIKit_UIImage) | null>
Swift declaration@MainActor final var uiImage: UIImage? { get }
The current contents of the view, rasterized as a UIKit image.
The renderer notifies its `objectWillChange` publisher when
the contents of the image may have changed.
get · iOS 18.0+containerValues
TypeScriptget containerValues(): _SwiftUICore_ContainerValues
Swift declarationvar containerValues: ContainerValues { get }
The container values associated with the given subview.
static · iOS 27.0+processingTask
TypeScriptstatic processingTask(identifier: string): BackgroundTask<void, void>
Swift declarationstatic func processingTask(_ identifier: String) -> BackgroundTask<Void, Void>
A task that processes tasks in the background.
static · iOS 16.0+appRefresh
TypeScriptstatic appRefresh(identifier: string): BackgroundTask<void, void>
Swift declarationstatic func appRefresh(_ identifier: String) -> BackgroundTask<Void, Void>
A task that updates your app’s state in the background for a
matching identifier.
- Parameter identifier: The identifier to match.
- Returns: A background task that you can handle with your app or
extension.
get · iOS 16.0+urlSession
TypeScriptstatic get urlSession(): BackgroundTask<string, void>
Swift declarationstatic var urlSession: BackgroundTask<String, Void> { get }
A task that responds to background URL sessions.
static · iOS 16.0+urlSession
TypeScriptstatic urlSession88335(identifier: string): BackgroundTask<void, void>
Swift declarationstatic func urlSession(_ identifier: String) -> BackgroundTask<Void, Void>
A task that responds to background URL sessions matching the given
identifier.
- Parameter identifier: The identifier to match.
- Returns: A background task that you can handle with your app or
extension.
get · iOS 15.0+sortDescriptors
TypeScriptget sortDescriptors(): Promise<Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get nonmutating set }
The request's sort descriptors, accessed as value types.
Set this value to cause the associated ``FetchRequest`` to execute a
fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances.
The order of entities stored in the results collection may change
as a result.
If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``FetchedResults/nsSortDescriptors`` instead.
set · iOS 15.0+sortDescriptors
TypeScriptsetSortDescriptors(value: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>): Promise<void>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get nonmutating set }
The request's sort descriptors, accessed as value types.
Set this value to cause the associated ``FetchRequest`` to execute a
fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances.
The order of entities stored in the results collection may change
as a result.
If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``FetchedResults/nsSortDescriptors`` instead.
get · iOS 14.0+wrappedValue
TypeScriptget wrappedValue(): (unknown) | null
Swift declarationvar wrappedValue: Value? { get nonmutating set }
The unwrapped value for the focus key given the current scope and state
of the focused view hierarchy.
set · iOS 14.0+wrappedValue
TypeScriptset wrappedValue(value: (unknown) | null)
Swift declarationvar wrappedValue: Value? { get nonmutating set }
The unwrapped value for the focus key given the current scope and state
of the focused view hierarchy.
get · iOS 14.0+projectedValue
TypeScriptget projectedValue(): _SwiftUICore_Binding<(unknown) | null>
Swift declarationvar projectedValue: Binding<Value?> { get }
A binding to the optional value.
The unwrapped value is `nil` when no focused view hierarchy has
published a corresponding binding.
init · iOS 14.0+init
TypeScriptstatic init(keyPath: SDKHandle): FocusedBinding<unknown>
Swift declarationinit(_ keyPath: KeyPath<FocusedValues, Binding<Value>?>)
A new property wrapper for the given key path.
The value of the property wrapper is updated dynamically as focus
changes and different published bindings go in and out of scope.
- Parameter keyPath: The key path for the focus value to read.
init · iOS 16.0+init
TypeScriptstatic init(configuration: LabeledContentStyleConfiguration): LabeledContent<LabeledContentStyleConfiguration_Label, LabeledContentStyleConfiguration_Content>
Swift declarationinit(_ configuration: LabeledContentStyleConfiguration)
Creates labeled content based on a labeled content style configuration.
You can use this initializer within the
``LabeledContentStyle/makeBody(configuration:)`` method of a
``LabeledContentStyle`` to create a labeled content instance.
This is useful for custom styles that only modify the current style,
as opposed to implementing a brand new style.
For example, the following style adds a red border around the labeled
content, but otherwise preserves the current style:
struct RedBorderLabeledContentStyle: LabeledContentStyle {
func makeBody(configuration: Configuration) -> some View {
LabeledContent(configuration)
.border(.red)
}
}
- Parameter configuration: The properties of the labeled content
init · iOS 26.0+init
TypeScriptstatic initValue(titleResource: _Foundation_LocalizedStringResource, value: string): LabeledContent<_SwiftUICore_Text, _SwiftUICore_Text>
Swift declarationinit<S>(_ titleResource: LocalizedStringResource, value: S) where S : StringProtocol
Creates a labeled informational view.
This initializer creates a ``Text`` label on your behalf. See
`Text` for more information about localizing strings.
Form {
LabeledContent("Name", value: person.name)
}
In some contexts, this text will be selectable by default.
- Parameters:
- titleResource: Text resource for the view's localized title, that
describes the purpose of the view.
- value: The value being labeled.
init · iOS 16.0+init
TypeScriptstatic initValue57286(titleKey: _SwiftUICore_LocalizedStringKey, value: string): LabeledContent<_SwiftUICore_Text, _SwiftUICore_Text>
Swift declarationinit<S>(_ titleKey: LocalizedStringKey, value: S) where S : StringProtocol
Creates a labeled informational view.
This initializer creates a ``Text`` label on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
`Text` for more information about localizing strings.
Form {
LabeledContent("Name", value: person.name)
}
In some contexts, this text will be selectable by default.
- Parameters:
- titleKey: The key for the view's localized title, that describes
the purpose of the view.
- value: The value being labeled.
init · iOS 16.0+init
TypeScriptstatic initValue9836(title: string, value: string): LabeledContent<_SwiftUICore_Text, _SwiftUICore_Text>
Swift declarationinit<S1, S2>(_ title: S1, value: S2) where S1 : StringProtocol, S2 : StringProtocol
Creates a labeled informational view.
This initializer creates a ``Text`` label on your behalf, and treats the
title similar to ``Text/init(_:)``. See `Text` for more
information about localizing strings.
Form {
ForEach(person.pet) { pet in
LabeledContent(pet.species, value: pet.name)
}
}
- Parameters:
- title: A string that describes the purpose of the view.
- value: The value being labeled.
init · iOS 13.0+ · Deprecated in iOS 16.0init
TypeScriptstatic initDestinationTagSelection(titleKey: _SwiftUICore_LocalizedStringKey, destination: SDKHandle, tag: number, selection: _SwiftUICore_Binding<(number) | null>): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init<V>(_ titleKey: LocalizedStringKey, destination: Destination, tag: V, selection: Binding<V?>) where V : Hashable
Creates a navigation link that presents a destination view when a bound
selection variable matches a value you provide, using a text label
that the link generates from a localized string key.
- Parameters:
- titleKey: A localized string key for creating a text label.
- destination: A view for the navigation link to present.
- tag: The value of `selection` that causes the link to present
`destination`.
- selection: A bound variable that causes the link to present
`destination` when `selection` becomes equal to `tag`.
init · iOS 13.0+ · Deprecated in iOS 16.0init
TypeScriptstatic initDestinationTagSelection922(title: string, destination: SDKHandle, tag: number, selection: _SwiftUICore_Binding<(number) | null>): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init<S, V>(_ title: S, destination: Destination, tag: V, selection: Binding<V?>) where S : StringProtocol, V : Hashable
Creates a navigation link that presents a destination view when a bound
selection variable matches a value you provide, using a text label
that the link generates from a title string.
- Parameters:
- title: A string for creating a text label.
- destination: A view for the navigation link to present.
- tag: The value of `selection` that causes the link to present
`destination`.
- selection: A bound variable that causes the link to present
`destination` when `selection` becomes equal to `tag`.
init · iOS 13.0+ · Deprecated in iOS 16.0init
TypeScriptstatic initDestinationIsActive(titleKey: _SwiftUICore_LocalizedStringKey, destination: SDKHandle, isActive: _SwiftUICore_Binding<boolean>): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, destination: Destination, isActive: Binding<Bool>)
Creates a navigation link that presents a destination view when active, with a
text label that the link generates from a localized string key.
- Parameters:
- titleKey: A localized string key for creating a text label.
- destination: A view for the navigation link to present.
- isActive: A binding to a Boolean value that indicates whether
`destination` is currently presented.
init · iOS 13.0+ · Deprecated in iOS 16.0init
TypeScriptstatic initDestinationIsActive30425(title: string, destination: SDKHandle, isActive: _SwiftUICore_Binding<boolean>): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init<S>(_ title: S, destination: Destination, isActive: Binding<Bool>) where S : StringProtocol
Creates a navigation link that presents a destination view when active, with a
text label that the link generates from a title string.
- Parameters:
- title: A string for creating a text label.
- destination: A view for the navigation link to present.
- isActive: A binding to a Boolean value that indicates whether
`destination` is currently presented.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initDestination(titleKey: _SwiftUICore_LocalizedStringKey, destination: SDKHandle): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, destination: Destination)
Creates a navigation link that presents a destination view, with a text
label that the link generates from a localized string key.
- Parameters:
- titleKey: A localized string key for creating a text label.
- destination: A view for the navigation link to present.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initDestination15650(title: string, destination: SDKHandle): NavigationLink<_SwiftUICore_Text, SDKHandle>
Swift declarationnonisolated init<S>(_ title: S, destination: Destination) where S : StringProtocol
Creates a navigation link that presents a destination view, with a text
label that the link generates from a title string.
- Parameters:
- title: A string for creating a text label.
- destination: A view for the navigation link to present.
init · iOS 16.0+init
TypeScriptstatic initValue(titleResource: _Foundation_LocalizedStringResource, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declaration@export(implementation) nonisolated init<P>(_ titleResource: LocalizedStringResource, value: P?) where Label == Text, P : Hashable
Creates a navigation link that presents the view corresponding to a
value, with a text label that the link generates from a
localized string resource.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
If you want to be able to serialize a ``NavigationPath`` that includes
this link, use a `value` that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol.
- Parameters:
- titleResource: A localized string that describes the view that this
link presents.
- value: An optional value to present.
When the user selects the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 16.0+init
TypeScriptstatic initValue73146(titleResource: _Foundation_LocalizedStringResource, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declaration@export(implementation) nonisolated init<P>(_ titleResource: LocalizedStringResource, value: P?) where Label == Text, P : Decodable, P : Encodable, P : Hashable
Creates a navigation link that presents the view corresponding to a
codable value, with a text label that the link generates from a
localized string resource.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
Because this initializer takes a value that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol,
you ensure that a ``NavigationPath`` that includes this link can produce
a non-`nil` value for its ``NavigationPath/codable`` property. This
helps to make the path serializable.
- Parameters:
- titleResource: A localized string that describes the view that this
link presents.
- value: An optional value to present. When someone
taps or clicks the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 16.0+init
TypeScriptstatic initValue96595(titleKey: _SwiftUICore_LocalizedStringKey, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declarationnonisolated init<P>(_ titleKey: LocalizedStringKey, value: P?) where Label == Text, P : Hashable
Creates a navigation link that presents the view corresponding to a
value, with a text label that the link generates from a
localized string key.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
If you want to be able to serialize a ``NavigationPath`` that includes
this link, use a `value` that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol.
- Parameters:
- titleKey: A localized string that describes the view that this link
presents.
- value: An optional value to present.
When the user selects the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 16.0+init
TypeScriptstatic initValue16899(titleKey: _SwiftUICore_LocalizedStringKey, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declarationnonisolated init<P>(_ titleKey: LocalizedStringKey, value: P?) where Label == Text, P : Decodable, P : Encodable, P : Hashable
Creates a navigation link that presents the view corresponding to a
codable value, with a text label that the link generates from a
localized string key.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
Because this initializer takes a value that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol,
you ensure that a ``NavigationPath`` that includes this link can produce
a non-`nil` value for its ``NavigationPath/codable`` property. This
helps to make the path serializable.
- Parameters:
- titleKey: A localized string that describes the view that this link
presents.
- value: An optional value to present. When someone
taps or clicks the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 16.0+init
TypeScriptstatic initValue11019(title: string, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declarationnonisolated init<S, P>(_ title: S, value: P?) where Label == Text, S : StringProtocol, P : Hashable
Creates a navigation link that presents the view corresponding to a
value, with a text label that the link generates from a
title string.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
If you want to be able to serialize a ``NavigationPath`` that includes
this link, use a `value` that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol.
- Parameters:
- title: A string that describes the view that this link presents.
- value: An optional value to present.
When the user selects the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 16.0+init
TypeScriptstatic initValue83067(title: string, value?: (number) | null): NavigationLink<_SwiftUICore_Text, never>
Swift declarationnonisolated init<S, P>(_ title: S, value: P?) where Label == Text, S : StringProtocol, P : Decodable, P : Encodable, P : Hashable
Creates a navigation link that presents the view corresponding to a
codable value, with a text label that the link generates from a
title string.
When someone activates the navigation link that this initializer
creates, SwiftUI looks for a nearby
``View/navigationDestination(for:destination:)`` view modifier
with a `data` input parameter that matches the type of this
initializer's `value` input, with one of the following outcomes:
* If SwiftUI finds a matching modifier within the view hierarchy of an
enclosing ``NavigationStack``, it pushes the modifier's corresponding
`destination` view onto the stack.
* If SwiftUI finds a matching modifier in the view hierarchy of a stack
that's in a later column of a ``NavigationSplitView``, it puts the
modifier's destination view as the first and only item onto the stack
while preserving the stack's root view.
* If there's no matching modifier, but the link appears in a ``List``
with selection inside a leading column of a navigation split view,
the link updates the selection, which might affect the appearance of
a trailing view. For an example of this, see ``NavigationLink``.
* In other cases, the link doesn't do anything.
Because this initializer takes a value that conforms to the
<doc://com.apple.documentation/documentation/Swift/Codable> protocol,
you ensure that a ``NavigationPath`` that includes this link can produce
a non-`nil` value for its ``NavigationPath/codable`` property. This
helps to make the path serializable.
- Parameters:
- title: A string that describes the view that this link presents.
- value: An optional value to present.
When the user selects the link, SwiftUI stores a copy of the value.
Pass a `nil` value to disable the link.
init · iOS 15.0+init
TypeScriptinit(uiSizeCategory: _UIKit_UIContentSizeCategory): (_SwiftUICore_DynamicTypeSize) | null
Swift declarationinit?(_ uiSizeCategory: UIContentSizeCategory)
Create a Dynamic Type size from its `UIContentSizeCategory` equivalent.
init · iOS 14.0+init
TypeScriptinit(uiLayoutDirection: _UIKit_UITraitEnvironmentLayoutDirection): (_SwiftUICore_LayoutDirection) | null
Swift declarationinit?(_ uiLayoutDirection: UITraitEnvironmentLayoutDirection)
Create a direction from its UITraitEnvironmentLayoutDirection equivalent.
method · iOS 15.0+accessibilityTextContentType
TypeScriptaccessibilityTextContentType(textContentType: _SwiftUICore_AccessibilityTextContentType): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityTextContentType(_ textContentType: AccessibilityTextContentType) -> ModifiedContent<Content, Modifier>
Sets an accessibility text content type.
Use this modifier to set the content type of this accessibility
element. Assistive technologies can use this property to choose
an appropriate way to output the text. For example, when
encountering a source coding context, VoiceOver could
choose to speak all punctuation.
The default content type ``AccessibilityTextContentType/plain``.
- Parameter textContentType: The accessibility content type from the available
``AccessibilityTextContentType`` options.
method · iOS 16.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance(label: _Foundation_LocalizedStringResource, value: _SwiftUICore_Text, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityCustomContent(_ label: LocalizedStringResource, _ value: Text, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example: `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter label: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter value: Text resource for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 16.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance10348(label: _Foundation_LocalizedStringResource, valueResource: _Foundation_LocalizedStringResource, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityCustomContent(_ label: LocalizedStringResource, _ valueResource: LocalizedStringResource, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter label: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter valueResource: Text resource for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 16.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance46334(key: _SwiftUICore_AccessibilityCustomContentKey, valueResource: _Foundation_LocalizedStringResource, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityCustomContent(_ key: AccessibilityCustomContentKey, _ valueResource: LocalizedStringResource, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter key: Key used to specify the identifier and label of the
of the additional accessibility information entry.
- Parameter valueResource: Text resource for the additional accessibility
information. For example: "landscape." A value of `nil` will remove
any entry of additional information added earlier for any `key` with
the same identifier.
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with `key`s
having different identifiers will create new entries of
additional information.
Calling `accessibilityCustomContent` repeatedly with `key`s
having matching identifiers will replace the previous entry.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance12196(key: _SwiftUICore_AccessibilityCustomContentKey, valueKey: _SwiftUICore_LocalizedStringKey, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent(_ key: AccessibilityCustomContentKey, _ valueKey: LocalizedStringKey, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter key: Key used to specify the identifier and label of the
of the additional accessibility information entry.
- Parameter valueKey: Text value for the additional accessibility
information. For example: "landscape." A value of `nil` will remove
any entry of additional information added earlier for any `key` with
the same identifier.
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with `key`s
having different identifiers will create new entries of
additional information.
Calling `accessibilityCustomContent` repeatedly with `key`s
having matching identifiers will replace the previous entry.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance91880(key: _SwiftUICore_AccessibilityCustomContentKey, value?: (_SwiftUICore_Text) | null, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent(_ key: AccessibilityCustomContentKey, _ value: Text?, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter key: Key used to specify the identifier and label of the
of the additional accessibility information entry.
- Parameter value: Text value for the additional accessibility
information. For example: "landscape." A value of `nil` will remove
any entry of additional information added earlier for any `key` with
the same identifier.
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with `key`s
having different identifiers will create new entries of
additional information.
Calling `accessibilityCustomContent` repeatedly with `key`s
having matching identifiers will replace the previous entry.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance44464(key: _SwiftUICore_AccessibilityCustomContentKey, value: string, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent<V>(_ key: AccessibilityCustomContentKey, _ value: V, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier> where V : StringProtocol
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter key: Key used to specify the identifier and label of the
of the additional accessibility information entry.
- Parameter value: Text value for the additional accessibility
information. For example: "landscape." A value of `nil` will remove
any entry of additional information added earlier for any `key` with
the same identifier.
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with `key`s
having different identifiers will create new entries of
additional information.
Calling `accessibilityCustomContent` repeatedly with `key`s
having matching identifiers will replace the previous entry.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance34294(labelKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Text, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent(_ labelKey: LocalizedStringKey, _ value: Text, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example: `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter labelKey: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter value: Text value for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance87932(labelKey: _SwiftUICore_LocalizedStringKey, valueKey: _SwiftUICore_LocalizedStringKey, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent(_ labelKey: LocalizedStringKey, _ valueKey: LocalizedStringKey, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter labelKey: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter valueKey: Text value for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance10724(labelKey: _SwiftUICore_LocalizedStringKey, value: string, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent<V>(_ labelKey: LocalizedStringKey, _ value: V, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier> where V : StringProtocol
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example, `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter labelKey: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter value: Text value for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 15.0+accessibilityCustomContent
TypeScriptaccessibilityCustomContentImportance47391(label: _SwiftUICore_Text, value: _SwiftUICore_Text, importance?: _Accessibility_AXCustomContent_Importance): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityCustomContent(_ label: Text, _ value: Text, importance: AXCustomContent.Importance = .default) -> ModifiedContent<Content, Modifier>
Add additional accessibility information to the view.
Use this method to add information you want accessibility users to be
able to access about this element, beyond the basics of label, value,
and hint. For example: `accessibilityCustomContent` can be used to add
information about the orientation of a photograph, or the number of
people found in the picture.
- Parameter label: Localized text describing to the user what
is contained in this additional information entry. For example:
"orientation".
- Parameter value: Text value for the additional accessibility
information. For example: "landscape."
- Parameter importance: Importance of the accessibility information.
High-importance information gets read out immediately, while
default-importance information must be explicitly asked for by the
user.
- Note: Repeated calls of `accessibilityCustomContent` with different
labels will create new entries of additional information. Calling
`accessibilityCustomContent` repeatedly with the same label will
instead replace the previous value and importance.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityIdentifier(identifier: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(identifier: String) -> ModifiedContent<Content, Modifier>
Uses the specified string to identify the view.
Use this value for testing. It isn't visible to the user.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityInputLabels(inputLabels: Array<_SwiftUICore_Text>): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(inputLabels: [Text]) -> ModifiedContent<Content, Modifier>
Sets alternate input labels with which users identify a view.
If you don't specify any input labels, the user can still refer to the view using the accessibility
label that you add with the accessibilityLabel() modifier. Provide labels in descending order
of importance. Voice Control and Full Keyboard Access use the input labels.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityRemoveTraits(traits: _SwiftUICore_AccessibilityTraits): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(removeTraits traits: AccessibilityTraits) -> ModifiedContent<Content, Modifier>
Removes the given traits from this view.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilitySortPriority(sortPriority: number): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(sortPriority: Double) -> ModifiedContent<Content, Modifier>
Sets the sort priority order for this view's accessibility
element, relative to other elements at the same level.
Higher numbers are sorted first. The default sort priority is zero.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityActivationPoint(activationPoint: _SwiftUICore_UnitPoint): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(activationPoint: UnitPoint) -> ModifiedContent<Content, Modifier>
Specifies the unit point where activations occur in the view.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityActivationPoint50753(activationPoint: { x: number; y: number }): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(activationPoint: CGPoint) -> ModifiedContent<Content, Modifier>
Specifies the point where activations occur in the view.
method · iOS 13.0+ · Deprecatedaccessibility
TypeScriptaccessibilitySelectionIdentifier(selectionIdentifier: unknown): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(selectionIdentifier: AnyHashable) -> ModifiedContent<Content, Modifier>
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityHint(hint: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(hint: Text) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item" or
"Downloads the attachment".
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityLabel(label: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(label: Text) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
For example, you could use this method to label a button that plays music with the text "Play".
Don't include text in the label that repeats information that users already have. For example,
don't use the label "Play button" because a button already has a trait that identifies it as a button.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityValue(value: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(value: Text) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only if that's different than the
view's label. For example, for a slider that you label as "Volume" using accessibility(label:),
you can provide the current volume setting, like "60%", using accessibility(value:).
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityHidden(hidden: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(hidden: Bool) -> ModifiedContent<Content, Modifier>
Specifies whether to hide this view from system accessibility features.
method · iOS 13.0+ · Deprecated in iOS 100000.0accessibility
TypeScriptaccessibilityAddTraits(traits: _SwiftUICore_AccessibilityTraits): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibility(addTraits traits: AccessibilityTraits) -> ModifiedContent<Content, Modifier>
Adds the given traits to the view.
method · iOS 18.0+accessibilityHint
TypeScriptaccessibilityHintIsEnabled(hint: _Foundation_LocalizedStringResource, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityHint(_ hint: LocalizedStringResource, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
- Parameters:
- hint: The accessibility hint to apply.
- isEnabled: If true the accessibility hint is applied; otherwise the
accessibility hint is unchanged.
method · iOS 18.0+accessibilityHint
TypeScriptaccessibilityHintIsEnabled33751(hintKey: _SwiftUICore_LocalizedStringKey, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint(_ hintKey: LocalizedStringKey, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
- Parameters:
- hintKey: The accessibility hint to apply.
- isEnabled: If true the accessibility hint is applied; otherwise the
accessibility hint is unchanged.
method · iOS 18.0+accessibilityHint
TypeScriptaccessibilityHintIsEnabled90268(hint: _SwiftUICore_Text, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint(_ hint: Text, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
> Note: On macOS, if the view does not have an action and it has been
made into a container with ``accessibilityElement(children: .contain)``,
this will be used to describe the container. For example, if the
container is for a graph, the hint could be "graph".
- Parameters:
- hint: The accessibility hint to apply.
- isEnabled: If true the accessibility hint is applied; otherwise the
accessibility hint is unchanged.
method · iOS 18.0+accessibilityHint
TypeScriptaccessibilityHintIsEnabled7070(hint: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint<S>(_ hint: S, isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
- Parameters:
- hint: The accessibility hint to apply.
- isEnabled: If true the accessibility hint is applied; otherwise the
accessibility hint is unchanged.
method · iOS 16.0+accessibilityHint
TypeScriptaccessibilityHint6706(hint: _Foundation_LocalizedStringResource): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityHint(_ hint: LocalizedStringResource) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
method · iOS 14.0+accessibilityHint
TypeScriptaccessibilityHint79825(hintKey: _SwiftUICore_LocalizedStringKey): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint(_ hintKey: LocalizedStringKey) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
method · iOS 14.0+accessibilityHint
TypeScriptaccessibilityHint49722(hint: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint(_ hint: Text) -> ModifiedContent<Content, Modifier>
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
> Note: On macOS, if the view does not have an action and it has been
made into a container with ``accessibilityElement(children: .contain)``,
this will be used to describe the container. For example, if the
container is for a graph, the hint could be "graph".
method · iOS 14.0+accessibilityHint
TypeScriptaccessibilityHint1752(hint: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHint<S>(_ hint: S) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Communicates to the user what happens after performing the view's
action.
Provide a hint in the form of a brief phrase, like "Purchases the item"
or "Downloads the attachment".
method · iOS 18.0+accessibilityLabel
TypeScriptaccessibilityLabelIsEnabled(label: _Foundation_LocalizedStringResource, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityLabel(_ label: LocalizedStringResource, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that
doesn't display text, like an icon. For example, you could use this
method to label a button that plays music with the text "Play". Don't
include text in the label that repeats information that users already
have. For example, don't use the label "Play button" because a button
already has a trait that identifies it as a button.
- Parameters:
- label: The accessibility label to apply.
- isEnabled: If true the accessibility label is applied; otherwise
the accessibility label is unchanged.
method · iOS 18.0+accessibilityLabel
TypeScriptaccessibilityLabelIsEnabled24399(labelKey: _SwiftUICore_LocalizedStringKey, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel(_ labelKey: LocalizedStringKey, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that
doesn't display text, like an icon. For example, you could use this
method to label a button that plays music with the text "Play". Don't
include text in the label that repeats information that users already
have. For example, don't use the label "Play button" because a button
already has a trait that identifies it as a button.
- Parameters:
- labelKey: The accessibility label to apply.
- isEnabled: If true the accessibility label is applied; otherwise
the accessibility label is unchanged.
method · iOS 18.0+accessibilityLabel
TypeScriptaccessibilityLabelIsEnabled83668(label: _SwiftUICore_Text, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel(_ label: Text, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that
doesn't display text, like an icon. For example, you could use this
method to label a button that plays music with the text "Play". Don't
include text in the label that repeats information that users already
have. For example, don't use the label "Play button" because a button
already has a trait that identifies it as a button.
- Parameters:
- label: The accessibility label to apply.
- isEnabled: If true the accessibility label is applied; otherwise
the accessibility label is unchanged.
method · iOS 18.0+accessibilityLabel
TypeScriptaccessibilityLabelIsEnabled59766(label: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel<S>(_ label: S, isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that
doesn't display text, like an icon. For example, you could use this
method to label a button that plays music with the text "Play". Don't
include text in the label that repeats information that users already
have. For example, don't use the label "Play button" because a button
already has a trait that identifies it as a button.
- Parameters:
- label: The accessibility label to apply.
- isEnabled: If true the accessibility label is applied; otherwise
the accessibility label is unchanged.
method · iOS 16.0+accessibilityLabel
TypeScriptaccessibilityLabel51354(label: _Foundation_LocalizedStringResource): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityLabel(_ label: LocalizedStringResource) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that
doesn't display text, like an icon. For example, you could use this
method to label a button that plays music with the text "Play". Don't
include text in the label that repeats information that users already
have. For example, don't use the label "Play button" because a button
already has a trait that identifies it as a button.
method · iOS 14.0+accessibilityLabel
TypeScriptaccessibilityLabel23513(labelKey: _SwiftUICore_LocalizedStringKey): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel(_ labelKey: LocalizedStringKey) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
For example, you could use this method to label a button that plays music with the text "Play".
Don't include text in the label that repeats information that users already have. For example,
don't use the label "Play button" because a button already has a trait that identifies it as a button.
method · iOS 14.0+accessibilityLabel
TypeScriptaccessibilityLabel76226(label: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel(_ label: Text) -> ModifiedContent<Content, Modifier>
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
For example, you could use this method to label a button that plays music with the text "Play".
Don't include text in the label that repeats information that users already have. For example,
don't use the label "Play button" because a button already has a trait that identifies it as a button.
method · iOS 14.0+accessibilityLabel
TypeScriptaccessibilityLabel39648(label: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityLabel<S>(_ label: S) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Adds a label to the view that describes its contents.
Use this method to provide an accessibility label for a view that doesn't display text, like an icon.
For example, you could use this method to label a button that plays music with the text "Play".
Don't include text in the label that repeats information that users already have. For example,
don't use the label "Play button" because a button already has a trait that identifies it as a button.
method · iOS 18.0+accessibilityValue
TypeScriptaccessibilityValueIsEnabled(valueResource: _Foundation_LocalizedStringResource, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityValue(_ valueResource: LocalizedStringResource, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only
if that's different than the view's label. For example, for a slider
that you label as "Volume" using accessibilityLabel(), you can provide
the current volume setting, like "60%", using accessibilityValue().
- Parameters:
- valueResource: The accessibility value to apply.
- isEnabled: If true the accessibility value is applied; otherwise
the accessibility value is unchanged.
method · iOS 18.0+accessibilityValue
TypeScriptaccessibilityValueIsEnabled11436(valueKey: _SwiftUICore_LocalizedStringKey, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue(_ valueKey: LocalizedStringKey, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only
if that's different than the view's label. For example, for a slider
that you label as "Volume" using accessibilityLabel(), you can provide
the current volume setting, like "60%", using accessibilityValue().
- Parameters:
- valueKey: The accessibility value to apply.
- isEnabled: If true the accessibility value is applied; otherwise
the accessibility value is unchanged.
method · iOS 18.0+accessibilityValue
TypeScriptaccessibilityValueIsEnabled88301(valueDescription: _SwiftUICore_Text, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue(_ valueDescription: Text, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only
if that's different than the view's label. For example, for a slider
that you label as "Volume" using accessibilityLabel(), you can provide
the current volume setting, like "60%", using accessibilityValue().
- Parameters:
- valueDescription: The accessibility value to apply.
- isEnabled: If true the accessibility value is applied; otherwise
the accessibility value is unchanged.
method · iOS 18.0+accessibilityValue
TypeScriptaccessibilityValueIsEnabled67781(value: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue<S>(_ value: S, isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only
if that's different than the view's label. For example, for a slider
that you label as "Volume" using accessibilityLabel(), you can provide
the current volume setting, like "60%", using accessibilityValue().
- Parameters:
- value: The accessibility value to apply. When the value
is `nil`, the view will not provide any accessibility value.
- isEnabled: If true the accessibility value is applied; otherwise
the accessibility value is unchanged.
method · iOS 16.0+accessibilityValue
TypeScriptaccessibilityValue82539(valueResource: _Foundation_LocalizedStringResource): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityValue(_ valueResource: LocalizedStringResource) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only if
that's different than the view's label. For example, for a slider that
you label as "Volume" using accessibilityLabel(), you can provide the
current volume setting, like "60%", using accessibilityValue().
method · iOS 14.0+accessibilityValue
TypeScriptaccessibilityValue26398(valueKey: _SwiftUICore_LocalizedStringKey): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue(_ valueKey: LocalizedStringKey) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only if that's different than the
view's label. For example, for a slider that you label as "Volume" using accessibilityLabel(),
you can provide the current volume setting, like "60%", using accessibilityValue().
method · iOS 14.0+accessibilityValue
TypeScriptaccessibilityValue78983(valueDescription: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue(_ valueDescription: Text) -> ModifiedContent<Content, Modifier>
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only if that's different than the
view's label. For example, for a slider that you label as "Volume" using accessibilityLabel(),
you can provide the current volume setting, like "60%", using accessibilityValue().
method · iOS 14.0+accessibilityValue
TypeScriptaccessibilityValue55499(value: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityValue<S>(_ value: S) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Adds a textual description of the value that the view contains.
Use this method to describe the value represented by a view, but only if that's different than the
view's label. For example, for a slider that you label as "Volume" using accessibilityLabel(),
you can provide the current volume setting, like "60%", using accessibilityValue().
method · iOS 16.0+accessibilityAction
TypeScriptaccessibilityActionNamed(nameResource: _Foundation_LocalizedStringResource, handler: (() => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityAction(named nameResource: LocalizedStringResource, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility action to the view. Actions allow assistive
technologies, such as the VoiceOver, to interact with the view by
invoking the action.
For example, this is how a custom action to compose
a new email could be added to a view.
var body: some View {
ContentView()
.accessibilityAction(named: "New Message") {
// Handle action
}
}
method · iOS 14.0+accessibilityAction
TypeScriptaccessibilityActionNamed23798(nameKey: _SwiftUICore_LocalizedStringKey, handler: (() => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAction(named nameKey: LocalizedStringKey, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility action to the view. Actions allow assistive technologies,
such as the VoiceOver, to interact with the view by invoking the action.
For example, this is how a custom action to compose
a new email could be added to a view.
var body: some View {
ContentView()
.accessibilityAction(named: "New Message") {
// Handle action
}
}
method · iOS 13.0+accessibilityAction
TypeScriptaccessibilityActionNamed39113(name: _SwiftUICore_Text, handler: (() => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAction(named name: Text, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility action to the view. Actions allow assistive technologies,
such as the VoiceOver, to interact with the view by invoking the action.
For example, this is how a custom action to compose
a new email could be added to a view.
var body: some View {
ContentView()
.accessibilityAction(named: Text("New Message")) {
// Handle action
}
}
method · iOS 14.0+accessibilityAction
TypeScriptaccessibilityActionNamed2533(name: string, handler: (() => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAction<S>(named name: S, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Adds an accessibility action to the view. Actions allow assistive technologies,
such as the VoiceOver, to interact with the view by invoking the action.
For example, this is how a custom action to compose
a new email could be added to a view.
var body: some View {
ContentView()
.accessibilityAction(named: "New Message") {
// Handle action
}
}
method · iOS 13.0+accessibilityAction
TypeScriptaccessibilityAction(actionKind: _SwiftUICore_AccessibilityActionKind, handler: (() => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAction(_ actionKind: AccessibilityActionKind = .default, _ handler: @escaping () -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility action to the view. Actions allow assistive technologies,
such as the VoiceOver, to interact with the view by invoking the action.
For example, this is how a `.default` action to compose
a new email could be added to a view.
var body: some View {
ContentView()
.accessibilityAction {
// Handle action
}
}
method · iOS 18.0+accessibilityHidden
TypeScriptaccessibilityHiddenIsEnabled(hidden: boolean, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHidden(_ hidden: Bool, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Specifies whether to hide this view from system accessibility features.
- Parameters:
- hidden: Whether to hide this view from accessibility features.
- isEnabled: If true the accessibility hidden state is applied;
otherwise the accessibility hidden state is unchanged.
method · iOS 14.0+accessibilityHidden
TypeScriptaccessibilityHidden39175(hidden: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHidden(_ hidden: Bool) -> ModifiedContent<Content, Modifier>
Specifies whether to hide this view from system accessibility features.
method · iOS 15.0+accessibilityHeading
TypeScriptaccessibilityHeading(level: _SwiftUICore_AccessibilityHeadingLevel): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityHeading(_ level: AccessibilityHeadingLevel) -> ModifiedContent<Content, Modifier>
Set the level of this heading.
Use this modifier to set the level of this heading in relation to other headings. The system speaks
the level number of levels ``AccessibilityHeadingLevel/h1``
through ``AccessibilityHeadingLevel/h6`` alongside the text.
The default heading level if you don’t use this modifier
is ``AccessibilityHeadingLevel/unspecified``.
- Parameter level: The heading level to associate with this element
from the available ``AccessibilityHeadingLevel`` levels.
method · iOS 14.0+accessibilityAddTraits
TypeScriptaccessibilityAddTraits763(traits: _SwiftUICore_AccessibilityTraits): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAddTraits(_ traits: AccessibilityTraits) -> ModifiedContent<Content, Modifier>
Adds the given traits to the view.
method · iOS 18.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescriptionIsEnabled(point: _SwiftUICore_UnitPoint, description: _Foundation_LocalizedStringResource, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityDragPoint(_ point: UnitPoint, description: LocalizedStringResource, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(
.center, description: Text("Move \(filename)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will begin a drag
interaction.
- description: The description of the drag interaction.
- isEnabled: If true the accessibility drag point is applied;
otherwise the accessibility drag point is unchanged.
method · iOS 18.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescriptionIsEnabled94838(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_LocalizedStringKey, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint(_ point: UnitPoint, description: LocalizedStringKey, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(
.center, description: Text("Move \(filename)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will begin a drag
interaction.
- description: The description of the drag interaction.
- isEnabled: If true the accessibility drag point is applied;
otherwise the accessibility drag point is unchanged.
method · iOS 18.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescriptionIsEnabled84627(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_Text, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint(_ point: UnitPoint, description: Text, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(
.center, description: Text("Move \(filename)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will begin a drag
interaction.
- description: The description of the drag interaction.
- isEnabled: If true the accessibility drag point is applied;
otherwise the accessibility drag point is unchanged.
method · iOS 18.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescriptionIsEnabled38855(point: _SwiftUICore_UnitPoint, description: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint<S>(_ point: UnitPoint, description: S, isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(
.center, description: Text("Move \(filename)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will begin a drag
interaction.
- description: The description of the drag interaction.
- isEnabled: If true the accessibility drag point is applied;
otherwise the accessibility drag point is unchanged.
method · iOS 16.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescription(point: _SwiftUICore_UnitPoint, description: _Foundation_LocalizedStringResource): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityDragPoint(_ point: UnitPoint, description: LocalizedStringResource) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(.center, description: "Move \(filename)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction,
each drag or drop should have a description to disambiguate it and give
a good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
method · iOS 16.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescription48707(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_LocalizedStringKey): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint(_ point: UnitPoint, description: LocalizedStringKey) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(.center, description: "Move \(filename)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
method · iOS 16.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescription75042(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint(_ point: UnitPoint, description: Text) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(.center, description: Text("Move \(filename)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
method · iOS 16.0+accessibilityDragPoint
TypeScriptaccessibilityDragPointDescription60812(point: _SwiftUICore_UnitPoint, description: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDragPoint<S>(_ point: UnitPoint, description: S) -> ModifiedContent<Content, Modifier> where S : StringProtocol
The point an assistive technology should use to begin a drag interaction.
Use this modifier when you need to provide a description to users
when prompted begin a drag interaction.
struct FileView: View {
var filename: String
var body: some View {
FileIcon(filename: filename)
.accessibilityDragPoint(.center, description: "Move \(filename)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drag, provided they have different descriptions.
method · iOS 18.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescriptionIsEnabled(point: _SwiftUICore_UnitPoint, description: _Foundation_LocalizedStringResource, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityDropPoint(_ point: UnitPoint, description: LocalizedStringResource, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(
.center, description: Text("Move to \(folderName)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will perform a drop
interaction.
- description: The description of the drop interaction.
- isEnabled: If true the accessibility drop point is applied;
otherwise the accessibility drop point is unchanged.
method · iOS 18.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescriptionIsEnabled12507(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_LocalizedStringKey, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint(_ point: UnitPoint, description: LocalizedStringKey, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(
.center, description: Text("Move to \(folderName)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will perform a drop
interaction.
- description: The description of the drop interaction.
- isEnabled: If true the accessibility drop point is applied;
otherwise the accessibility drop point is unchanged.
method · iOS 18.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescriptionIsEnabled53484(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_Text, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint(_ point: UnitPoint, description: Text, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(
.center, description: Text("Move to \(folderName)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will perform a drop
interaction.
- description: The description of the drop interaction.
- isEnabled: If true the accessibility drop point is applied;
otherwise the accessibility drop point is unchanged.
method · iOS 18.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescriptionIsEnabled11398(point: _SwiftUICore_UnitPoint, description: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint<S>(_ point: UnitPoint, description: S, isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(
.center, description: Text("Move to \(folderName)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction, each
drag or drop should have a description to disambiguate it and give a
good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
- Parameters:
- point: The point the assistive technology will perform a drop
interaction.
- description: The description of the drop interaction.
- isEnabled: If true the accessibility drop point is applied;
otherwise the accessibility drop point is unchanged.
method · iOS 16.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescription(point: _SwiftUICore_UnitPoint, description: _Foundation_LocalizedStringResource): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityDropPoint(_ point: UnitPoint, description: LocalizedStringResource) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(.center, description: "Move to \(folderName)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive
technologies. However, if there is more than one such interaction,
each drag or drop should have a description to disambiguate it and give
a good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
method · iOS 16.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescription92014(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_LocalizedStringKey): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint(_ point: UnitPoint, description: LocalizedStringKey) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(.center, description: "Move to \(folderName)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
method · iOS 16.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescription15621(point: _SwiftUICore_UnitPoint, description: _SwiftUICore_Text): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint(_ point: UnitPoint, description: Text) -> ModifiedContent<Content, Modifier>
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(.center, description: Text("Move to \(folderName)"))
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
method · iOS 16.0+accessibilityDropPoint
TypeScriptaccessibilityDropPointDescription58425(point: _SwiftUICore_UnitPoint, description: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDropPoint<S>(_ point: UnitPoint, description: S) -> ModifiedContent<Content, Modifier> where S : StringProtocol
The point an assistive technology should use to end a drag interaction.
Use this modifier when you need to provide a description to users
when prompted end a drag interaction.
struct FolderView: View {
var folderName: String
var body: some View {
FolderIcon(folderName: folderName)
.accessibilityDropPoint(.center, description: "Move to \(folderName)")
}
}
By default, if an accessible view or its subtree has drag and/or drop
interactions, they will be automatically exposed by assistive technologies.
However, if there is more than one such interaction, each drag or drop
should have a description to disambiguate it and give a good user experience.
- Note: An accessibility element can have multiple points
for a drop, provided they have different descriptions.
method · iOS 18.0+accessibilityIdentifier
TypeScriptaccessibilityIdentifierIsEnabled(identifier: string, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityIdentifier(_ identifier: String, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Uses the string you specify to identify the view.
Use this value for testing. It isn't visible to the user.
- Parameters:
- identifier: The accessibility identifier to apply.
- isEnabled: If true the accessibility identifier is applied;
otherwise the accessibility identifier is unchanged.
method · iOS 14.0+accessibilityIdentifier
TypeScriptaccessibilityIdentifier58166(identifier: string): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityIdentifier(_ identifier: String) -> ModifiedContent<Content, Modifier>
Uses the string you specify to identify the view.
Use this value for testing. It isn't visible to the user.
method · iOS 16.0+accessibilityZoomAction
TypeScriptaccessibilityZoomAction(handler: ((arg0: _SwiftUICore_AccessibilityZoomGestureAction) => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityZoomAction(_ handler: @escaping (AccessibilityZoomGestureAction) -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility zoom action to the view. Actions allow
assistive technologies, such as VoiceOver, to interact with the
view by invoking the action.
For example, this is how a zoom action is used to transform the scale
of a shape which has a `MagnificationGesture`.
var body: some View {
Circle()
.scaleEffect(magnifyBy)
.gesture(magnification)
.accessibilityLabel("Circle Magnifier")
.accessibilityZoomAction { action in
switch action.direction {
case .zoomIn:
magnifyBy += 0.5
case .zoomOut:
magnifyBy -= 0.5
}
}
}
method · iOS 17.0+accessibilityDirectTouch
TypeScriptaccessibilityDirectTouch(isDirectTouchArea?: boolean, options?: _SwiftUICore_AccessibilityDirectTouchOptions): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityDirectTouch(_ isDirectTouchArea: Bool = true, options: AccessibilityDirectTouchOptions = []) -> ModifiedContent<Content, Modifier>
Explicitly set whether this accessibility element is a direct touch
area. Direct touch areas passthrough touch events to the app rather
than being handled through an assistive technology, such as VoiceOver.
The modifier accepts an optional `AccessibilityDirectTouchOptions`
option set to customize the functionality of the direct touch area.
For example, this is how a direct touch area would allow a VoiceOver
user to interact with a view with a `rotationEffect` controlled by a
`RotationGesture`. The direct touch area would require a user to
activate the area before using the direct touch area.
var body: some View {
Rectangle()
.frame(width: 200, height: 200, alignment: .center)
.rotationEffect(angle)
.gesture(rotation)
.accessibilityDirectTouch(options: .requiresActivation)
}
method · iOS 18.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabelsIsEnabled(inputLabelKeys: Array<_SwiftUICore_LocalizedStringKey>, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels(_ inputLabelKeys: [LocalizedStringKey], isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Sets alternate input labels with which users identify a view.
Provide labels in descending order of importance. Voice Control
and Full Keyboard Access use the input labels.
> Note: If you don't specify any input labels, the user can still
refer to the view using the accessibility label that you add with the
`accessibilityLabel()` modifier.
- Parameters:
- inputLabelKeys: The accessibility input labels to apply.
- isEnabled: If true the accessibility input labels are applied;
otherwise the accessibility input labels are unchanged.
method · iOS 18.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabelsIsEnabled99384(inputLabels: Array<_SwiftUICore_Text>, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels(_ inputLabels: [Text], isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Sets alternate input labels with which users identify a view.
Provide labels in descending order of importance. Voice Control
and Full Keyboard Access use the input labels.
> Note: If you don't specify any input labels, the user can still
refer to the view using the accessibility label that you add with the
`accessibilityLabel()` modifier.
- Parameters:
- inputLabels: The accessibility input labels to apply.
- isEnabled: If true the accessibility input labels are applied;
otherwise the accessibility input labels are unchanged.
method · iOS 18.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabelsIsEnabled17654(inputLabels: Array<string>, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels<S>(_ inputLabels: [S], isEnabled: Bool) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Sets alternate input labels with which users identify a view.
Provide labels in descending order of importance. Voice Control
and Full Keyboard Access use the input labels.
> Note: If you don't specify any input labels, the user can still
refer to the view using the accessibility label that you add with the
`accessibilityLabel()` modifier.
- Parameters:
- inputLabels: The accessibility input labels to apply.
- isEnabled: If true the accessibility input labels are applied;
otherwise the accessibility input labels are unchanged.
method · iOS 14.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabels46653(inputLabelKeys: Array<_SwiftUICore_LocalizedStringKey>): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels(_ inputLabelKeys: [LocalizedStringKey]) -> ModifiedContent<Content, Modifier>
Sets alternate input labels with which users identify a view.
Provide labels in descending order of importance. Voice Control
and Full Keyboard Access use the input labels.
> Note: If you don't specify any input labels, the user can still
refer to the view using the accessibility label that you add with the
`accessibilityLabel()` modifier.
method · iOS 14.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabels87838(inputLabels: Array<_SwiftUICore_Text>): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels(_ inputLabels: [Text]) -> ModifiedContent<Content, Modifier>
Sets alternate input labels with which users identify a view.
If you don't specify any input labels, the user can still refer to the
view using the accessibility label that you add with the
accessibilityLabel() modifier. Provide labels in descending order
of importance. Voice Control and Full Keyboard Access use the input
labels.
method · iOS 14.0+accessibilityInputLabels
TypeScriptaccessibilityInputLabels50384(inputLabels: Array<string>): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityInputLabels<S>(_ inputLabels: [S]) -> ModifiedContent<Content, Modifier> where S : StringProtocol
Sets alternate input labels with which users identify a view.
Provide labels in descending order of importance. Voice Control
and Full Keyboard Access use the input labels.
> Note: If you don't specify any input labels, the user can still
refer to the view using the accessibility label that you add with the
`accessibilityLabel()` modifier.
method · iOS 14.0+accessibilityRemoveTraits
TypeScriptaccessibilityRemoveTraits63225(traits: _SwiftUICore_AccessibilityTraits): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityRemoveTraits(_ traits: AccessibilityTraits) -> ModifiedContent<Content, Modifier>
Removes the given traits from this view.
method · iOS 13.0+accessibilityScrollAction
TypeScriptaccessibilityScrollAction(handler: ((arg0: _SwiftUICore_Edge) => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityScrollAction(_ handler: @escaping (Edge) -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility scroll action to the view. Actions allow
assistive technologies, such as the VoiceOver, to interact with the
view by invoking the action.
For example, this is how a scroll action to trigger
a refresh could be added to a view.
var body: some View {
ScrollView {
ContentView()
}
.accessibilityScrollAction { edge in
if edge == .top {
// Refresh content
}
}
}
method · iOS 26.0+accessibilityScrollStatus
TypeScriptaccessibilityScrollStatusIsEnabled(status: _Foundation_LocalizedStringResource, isEnabled?: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declaration@export(implementation) nonisolated func accessibilityScrollStatus(_ status: LocalizedStringResource, isEnabled: Bool = true) -> ModifiedContent<Content, Modifier>
Changes the announcement provided by accessibility technologies
when a user scrolls a scroll view within this view.
Use this modifier to provide a description of the content at the
current position in the scroll view. For example, you could use this
modifier to announce the current month being scrolled to in a view that
contains a calendar.
@State private var position = ScrollPosition(idType: Month.ID.self)
ScrollView {
LazyVStack {
ForEach(months) { months in
MonthView(month: months)
}
}
.scrollTargetLayout()
}
.scrollPosition($position)
.accessibilityScrollStatus("\(months.name(position.viewID)) \(year)")
By default, VoiceOver announces "Page X of Y" while scrolling.
- Parameters:
- status: The current status of the scroll view.
- isEnabled: If true the accessibility scroll status is applied;
otherwise the accessibility scroll status is unchanged.
method · iOS 26.0+accessibilityScrollStatus
TypeScriptaccessibilityScrollStatusIsEnabled40666(statusKey: _SwiftUICore_LocalizedStringKey, isEnabled?: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityScrollStatus(_ statusKey: LocalizedStringKey, isEnabled: Bool = true) -> ModifiedContent<Content, Modifier>
Changes the announcement provided by accessibility technologies
when a user scrolls a scroll view within this view.
Use this modifier to provide a description of the content at the
current position in the scroll view. For example, you could use this
modifier to announce the current month being scrolled to in a view that
contains a calendar.
@State private var position = ScrollPosition(idType: Month.ID.self)
ScrollView {
LazyVStack {
ForEach(months) { months in
MonthView(month: months)
}
}
.scrollTargetLayout()
}
.scrollPosition($position)
.accessibilityScrollStatus("\(months.name(position.viewID)) \(year)")
By default, VoiceOver announces "Page X of Y" while scrolling.
- Parameters:
- statusKey: The current status of the scroll view.
- isEnabled: If true the accessibility scroll status is applied;
otherwise the accessibility scroll status is unchanged.
method · iOS 26.0+accessibilityScrollStatus
TypeScriptaccessibilityScrollStatusIsEnabled2479(status: _SwiftUICore_Text, isEnabled?: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityScrollStatus(_ status: Text, isEnabled: Bool = true) -> ModifiedContent<Content, Modifier>
Changes the announcement provided by accessibility technologies
when a user scrolls a scroll view within this view.
Use this modifier to provide a description of the content at the
current position in the scroll view. For example, you could use this
modifier to announce the current month being scrolled to in a view that
contains a calendar.
@State private var position = ScrollPosition(idType: Month.ID.self)
ScrollView {
LazyVStack {
ForEach(months) { months in
MonthView(month: months)
}
}
.scrollTargetLayout()
}
.scrollPosition($position)
.accessibilityScrollStatus("\(months.name(position.viewID)) \(year)")
By default, VoiceOver announces "Page X of Y" while scrolling.
- Parameters:
- status: The current status of the scroll view.
- isEnabled: If true the accessibility scroll status is applied;
otherwise the accessibility scroll status is unchanged.
method · iOS 26.0+accessibilityScrollStatus
TypeScriptaccessibilityScrollStatusIsEnabled58599(status: SDKHandle, isEnabled?: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityScrollStatus(_ status: some StringProtocol, isEnabled: Bool = true) -> ModifiedContent<Content, Modifier>
Changes the announcement provided by accessibility technologies
when a user scrolls a scroll view within this view.
Use this modifier to provide a description of the content at the
current position in the scroll view. For example, you could use this
modifier to announce the current month being scrolled to in a view that
contains a calendar.
@State private var position = ScrollPosition(idType: Month.ID.self)
ScrollView {
LazyVStack {
ForEach(months) { months in
MonthView(month: months)
}
}
.scrollTargetLayout()
}
.scrollPosition($position)
.accessibilityScrollStatus("\(months.name(position.viewID)) \(year)")
By default, VoiceOver announces "Page X of Y" while scrolling.
- Parameters:
- status: The current status of the scroll view.
- isEnabled: If true the accessibility scroll status is applied;
otherwise the accessibility scroll status is unchanged.
method · iOS 14.0+accessibilitySortPriority
TypeScriptaccessibilitySortPriority37866(sortPriority: number): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilitySortPriority(_ sortPriority: Double) -> ModifiedContent<Content, Modifier>
Sets the sort priority order for this view's accessibility
element, relative to other elements at the same level.
Higher numbers are sorted first. The default sort priority is zero.
method · iOS 18.0+accessibilityActivationPoint
TypeScriptaccessibilityActivationPointIsEnabled(activationPoint: _SwiftUICore_UnitPoint, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityActivationPoint(_ activationPoint: UnitPoint, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The activation point for an element is the location
assistive technologies use to initiate gestures.
Use this modifier to ensure that the activation point for a
small element remains accurate even if you present a larger
version of the element to VoiceOver.
If an activation point is not provided, an activation point
will be derived from one of the accessibility elements
decedents or from the center of the accessibility frame.
- Parameters:
- activationPoint: The accessibility activation point to apply.
- isEnabled: If true the accessibility activation point is applied;
otherwise the accessibility activation point is unchanged.
method · iOS 18.0+accessibilityActivationPoint
TypeScriptaccessibilityActivationPointIsEnabled45397(activationPoint: { x: number; y: number }, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityActivationPoint(_ activationPoint: CGPoint, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
The activation point for an element is the location
assistive technologies use to initiate gestures.
Use this modifier to ensure that the activation point for a
small element remains accurate even if you present a larger
version of the element to VoiceOver.
If an activation point is not provided, an activation point
will be derived from one of the accessibility elements
decedents or from the center of the accessibility frame.
- Parameters:
- activationPoint: The accessibility activation point to apply.
- isEnabled: If true the accessibility activation point is applied;
otherwise the accessibility activation point is unchanged.
method · iOS 14.0+accessibilityActivationPoint
TypeScriptaccessibilityActivationPoint17328(activationPoint: _SwiftUICore_UnitPoint): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityActivationPoint(_ activationPoint: UnitPoint) -> ModifiedContent<Content, Modifier>
The activation point for an element is the location
assistive technologies use to initiate gestures.
Use this modifier to ensure that the activation point for a
small element remains accurate even if you present a larger
version of the element to VoiceOver.
If an activation point is not provided, an activation point
will be derrived from one of the accessibility elements
decendents or from the center of the accessibility frame.
method · iOS 14.0+accessibilityActivationPoint
TypeScriptaccessibilityActivationPoint12063(activationPoint: { x: number; y: number }): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityActivationPoint(_ activationPoint: CGPoint) -> ModifiedContent<Content, Modifier>
The activation point for an element is the location
assistive technologies use to initiate gestures.
Use this modifier to ensure that the activation point for a
small element remains accurate even if you present a larger
version of the element to VoiceOver.
If an activation point is not provided, an activation point
will be derrived from one of the accessibility elements
decendents or from the center of the accessibility frame.
method · iOS 13.0+accessibilityAdjustableAction
TypeScriptaccessibilityAdjustableAction(handler: ((arg0: _SwiftUICore_AccessibilityAdjustmentDirection) => void)): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityAdjustableAction(_ handler: @escaping (AccessibilityAdjustmentDirection) -> Void) -> ModifiedContent<Content, Modifier>
Adds an accessibility adjustable action to the view. Actions allow
assistive technologies, such as the VoiceOver, to interact with the
view by invoking the action.
For example, this is how an adjustable action to navigate
through pages could be added to a view.
var body: some View {
PageControl()
.accessibilityAdjustableAction { direction in
switch direction {
case .increment:
// Go to next page
case .decrement:
// Go to previous page
}
}
}
method · iOS 18.0+accessibilityRespondsToUserInteraction
TypeScriptaccessibilityRespondsToUserInteractionIsEnabled(respondsToUserInteraction: boolean, isEnabled: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityRespondsToUserInteraction(_ respondsToUserInteraction: Bool, isEnabled: Bool) -> ModifiedContent<Content, Modifier>
Explicitly set whether this Accessibility element responds to user
interaction and would thus be interacted with by technologies such as
Switch Control, Voice Control or Full Keyboard Access.
If this is not set, the value is inferred from the traits of the
Accessibility element, the presence of Accessibility actions on the
element, or the presence of gestures on the element or containing views.
- Parameters:
- respondsToUserInteraction: Whether the view responds to user
interaction.
- isEnabled: If true the accessibility interaction state is applied;
otherwise the accessibility interaction state is unchanged.
method · iOS 15.0+accessibilityRespondsToUserInteraction
TypeScriptaccessibilityRespondsToUserInteraction(respondsToUserInteraction?: boolean): _SwiftUICore_ModifiedContent<unknown, AccessibilityAttachmentModifier>
Swift declarationnonisolated func accessibilityRespondsToUserInteraction(_ respondsToUserInteraction: Bool = true) -> ModifiedContent<Content, Modifier>
Explicitly set whether this Accessibility element responds to user
interaction and would thus be interacted with by technologies such as
Switch Control, Voice Control or Full Keyboard Access.
If this is not set, the value is inferred from the traits of the
Accessibility element, the presence of Accessibility actions on the
element, or the presence of gestures on the element or containing views.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Set<DateComponents>>, in bounds: Range<Date>)
Creates an instance that selects multiple dates in a range.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The exclusive range of selectable dates.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn4675(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeFrom<Date>)
Creates an instance that selects multiple dates on or after some
start date.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range from some selectable start date.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn53103(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeUpTo<Date>)
Creates an instance that selects multiple dates before some end date.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range before some end date.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn50233(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Set<DateComponents>>, in bounds: Range<Date>)
Creates an instance that selects multiple dates in a range.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The exclusive range of selectable dates.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn26086(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeFrom<Date>)
Creates an instance that selects multiple dates on or after some
start date.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range from some selectable start date.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn93242(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeUpTo<Date>)
Creates an instance that selects multiple dates before some end date.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range before some end date.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn56369(title: string, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Set<DateComponents>>, in bounds: Range<Date>) where S : StringProtocol
Creates an instance that selects multiple dates in a range.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date values being displayed and selected.
- bounds: The exclusive range of selectable dates.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn73510(title: string, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeFrom<Date>) where S : StringProtocol
Creates an instance that selects multiple dates on or after some
start date.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range from some selectable start date.
init · iOS 16.0+init
TypeScriptstatic initSelectionIn71402(title: string, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>, bounds: SDKHandle): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Set<DateComponents>>, in bounds: PartialRangeUpTo<Date>) where S : StringProtocol
Creates an instance that selects multiple dates before some end date.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date values being displayed and selected.
- bounds: The open range before some end date.
init · iOS 16.0+init
TypeScriptstatic initSelection(titleResource: _Foundation_LocalizedStringResource, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>): MultiDatePicker<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, selection: Binding<Set<DateComponents>>)
Creates an instance that selects multiple dates with an unbounded
range.
- Parameters:
- titleResource: The localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
init · iOS 16.0+init
TypeScriptstatic initSelection20105(titleKey: _SwiftUICore_LocalizedStringKey, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, selection: Binding<Set<DateComponents>>)
Creates an instance that selects multiple dates with an unbounded
range.
- Parameters:
- titleKey: The key for the localized title of `self`, describing
its purpose.
- selection: The date values being displayed and selected.
init · iOS 16.0+init
TypeScriptstatic initSelection43777(title: string, selection: _SwiftUICore_Binding<Array<_Foundation_DateComponents>>): MultiDatePicker<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, selection: Binding<Set<DateComponents>>) where S : StringProtocol
Creates an instance that selects multiple dates with an unbounded
range.
- Parameters:
- title: The title of `self`, describing its purpose.
- selection: The date values being displayed and selected.
init · iOS 14.0+init
TypeScriptinit(uiLegibilityWeight: _UIKit_UILegibilityWeight): (_SwiftUICore_LegibilityWeight) | null
Swift declarationinit?(_ uiLegibilityWeight: UILegibilityWeight)
Creates a legibility weight from its UILegibilityWeight equivalent.
get · iOS 14.0+content
TypeScriptget content(): ((arg0: ScrollViewProxy) => Promise<SDKHandle>)
Swift declarationvar content: (ScrollViewProxy) -> Content
The content builder that creates the reader's content.
get · iOS 13.0+content
TypeScriptget content(): SDKHandle
Swift declarationvar content: Content
The content view.
set · iOS 13.0+content
TypeScriptset content(value: SDKHandle)
Swift declarationvar content: Content
The content view.
init · iOS 16.0+init
TypeScriptstatic init(): ToolbarTitleMenu<_SwiftUICore_EmptyView>
Swift declarationnonisolated init() where Content == EmptyView
Creates a toolbar title menu where actions are inferred from your
apps commands.
get · iOS 16.0+openWindow
TypeScriptget openWindow(): OpenWindowAction
Swift declarationvar openWindow: OpenWindowAction { get }
A window presentation action stored in a view's environment.
Use the `openWindow` environment value to get an ``OpenWindowAction``
instance for a given ``Environment``. Then call the instance to open
a window. You call the instance directly because it defines a
``OpenWindowAction/callAsFunction(id:)`` method that Swift calls
when you call the instance.
For example, you can define a button that opens a new mail viewer
window:
@main
struct Mail: App {
var body: some Scene {
WindowGroup(id: "mail-viewer") {
MailViewer()
}
}
}
struct NewViewerButton: View {
@Environment(\.openWindow) private var openWindow
var body: some View {
Button("Open new mail viewer") {
openWindow(id: "mail-viewer")
}
}
}
You indicate which scene to open by providing one of the following:
* A string identifier that you pass through the `id` parameter,
as in the above example.
* A `value` parameter that has a type that matches the type that
you specify in the scene's initializer.
* Both an identifier and a value. This enables you to define
multiple window groups that take input values of the same type like a
<doc://com.apple.documentation/documentation/Foundation/UUID>.
Use the first option to target either a ``WindowGroup`` or a
``Window`` scene in your app that has a matching identifier. For a
`WindowGroup`, the system creates a new window for the group. If
the window group presents data, the system provides the default value
or `nil` to the window's root view. If the targeted scene is a
`Window`, the system orders it to the front.
Use the other two options to target a `WindowGroup` and provide
a value to present. If the interface already has a window from
the group that's presenting the specified value, the system brings the
window to the front. Otherwise, the system creates a new window and
passes a binding to the specified value.
get · iOS 14.0+scenePhase
TypeScriptget scenePhase(): ScenePhase
Swift declarationvar scenePhase: ScenePhase { get set }
The current phase of the scene.
The system sets this value to provide an indication of the
operational state of a scene or collection of scenes. The exact
meaning depends on where you access the value. For more information,
see ``ScenePhase``.
set · iOS 14.0+scenePhase
TypeScriptset scenePhase(value: ScenePhase)
Swift declarationvar scenePhase: ScenePhase { get set }
The current phase of the scene.
The system sets this value to provide an indication of the
operational state of a scene or collection of scenes. The exact
meaning depends on where you access the value. For more information,
see ``ScenePhase``.
get · iOS 26.0+findContext
TypeScriptget findContext(): (FindContext) | null
Swift declarationvar findContext: FindContext? { get }
get · iOS 15.0+isPresented
TypeScriptget isPresented(): boolean
Swift declarationvar isPresented: Bool { get }
A Boolean value that indicates whether the view associated with this
environment is currently presented.
You can read this value like any of the other ``EnvironmentValues``
by creating a property with the ``Environment`` property wrapper:
@Environment(\.isPresented) private var isPresented
Read the value inside a view if you need to know when SwiftUI
presents that view. For example, you can take an action when SwiftUI
presents a view by using the ``View/onChange(of:initial:_:)``
modifier:
.onChange(of: isPresented) { _, isPresented in
if isPresented {
// Do something when first presented.
}
}
This behaves differently than ``View/onAppear(perform:)``, which
SwiftUI can call more than once for a given presentation, like
when you navigate back to a view that's already in the
navigation hierarchy.
To dismiss the currently presented view, use
``EnvironmentValues/dismiss``.
get · iOS 15.0+isSearching
TypeScriptget isSearching(): boolean
Swift declarationvar isSearching: Bool { get }
A Boolean value that indicates when the user is searching.
You can read this value like any of the other ``EnvironmentValues``,
by creating a property with the ``Environment`` property wrapper:
@Environment(\.isSearching) private var isSearching
Get the value to find out when the user interacts with a search
field that's produced by one of the searchable modifiers, like
``View/searchable(text:placement:prompt:)``:
struct SearchingExample: View {
@State private var searchText = ""
var body: some View {
NavigationStack {
SearchedView()
.searchable(text: $searchText)
}
}
}
struct SearchedView: View {
@Environment(\.isSearching) private var isSearching
var body: some View {
Text(isSearching ? "Searching!" : "Not searching.")
}
}
When the user first taps or clicks in a search field, the
`isSearching` property becomes `true`. When the user cancels the
search operation, the property becomes `false`. To programmatically
set the value to `false` and dismiss the search operation, use
``EnvironmentValues/dismissSearch``.
> Important: Access the value from inside the searched view, as the
example above demonstrates, rather than from the searched view’s
parent. SwiftUI sets the value in the environment of the view that
you apply the searchable modifier to, and doesn’t propagate the
value up the view hierarchy.
get · iOS 13.0+undoManager
TypeScriptget undoManager(): (_Foundation_UndoManager) | null
Swift declarationvar undoManager: UndoManager? { get }
The undo manager used to register a view's undo operations.
This value is `nil` when the environment represents a context that
doesn't support undo and redo operations. You can skip registration of
an undo operation when this value is `nil`.
get · iOS 15.0+dismissSearch
TypeScriptget dismissSearch(): DismissSearchAction
Swift declarationvar dismissSearch: DismissSearchAction { get }
An action that ends the current search interaction.
Use this environment value to get the ``DismissSearchAction`` instance
for the current ``Environment``. Then call the instance to dismiss
the current search interaction. You call the instance directly because
it defines a ``DismissSearchAction/callAsFunction()`` method that Swift
calls when you call the instance.
When you dismiss search, SwiftUI:
* Sets ``EnvironmentValues/isSearching`` to `false`.
* Clears any text from the search field.
* Removes focus from the search field.
> Note: Calling this instance has no effect if the user isn't
interacting with a search field.
Use this action to dismiss a search operation based on
another user interaction. For example, consider a searchable
view with a ``Button`` that presents more information about the first
matching item from a collection:
struct ContentView: View {
@State private var searchText = ""
var body: some View {
NavigationStack {
SearchedView(searchText: searchText)
.searchable(text: $searchText)
}
}
}
private struct SearchedView: View {
let searchText: String
let items = ["a", "b", "c"]
var filteredItems: [String] { items.filter { $0 == searchText.lowercased() } }
@State private var isPresented = false
@Environment(\.dismissSearch) private var dismissSearch
var body: some View {
if let item = filteredItems.first {
Button("Details about \(item)") {
isPresented = true
}
.sheet(isPresented: $isPresented) {
NavigationStack {
DetailView(item: item, dismissSearch: dismissSearch)
}
}
}
}
}
The button becomes visible only after the user enters search text
that produces a match. When the user taps the button, SwiftUI shows
a sheet that provides more information about the item, including
an Add button for adding the item to a stored list of items:
private struct DetailView: View {
var item: String
var dismissSearch: DismissSearchAction
@Environment(\.dismiss) private var dismiss
var body: some View {
Text("Information about \(item).")
.toolbar {
Button("Add") {
// Store the item here...
dismiss()
dismissSearch()
}
}
}
}
People can dismiss the sheet by dragging it down, effectively
canceling the operation, leaving the in-progress search interaction
intact. Alternatively, people can tap the Add button to store the item.
Because the person using your app is likely to be done with both the
detail view and the search interaction at this point, the button's
closure also uses the ``EnvironmentValues/dismiss`` property to dismiss
the sheet, and the ``EnvironmentValues/dismissSearch`` property to
reset the search field.
> Important: Access the action from inside the searched view, as the
example above demonstrates, rather than from the searched view’s
parent, or another hierarchy, like that of a sheet. SwiftUI sets the
value in the environment of the view that you apply the searchable
modifier to, and doesn’t propagate the value up the view hierarchy.
get · iOS 17.0+dismissWindow
TypeScriptget dismissWindow(): DismissWindowAction
Swift declarationvar dismissWindow: DismissWindowAction { get }
A window dismissal action stored in a view's environment.
Use the `dismissWindow` environment value to get an
``DismissWindowAction`` instance for a given ``Environment``. Then call
the instance to dismiss a window. You call the instance directly because
it defines a ``DismissWindowAction/callAsFunction(id:)`` method that
Swift calls when you call the instance.
For example, you can define a button that dismisses an auxiliary window:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
#if os(macOS)
Window("Auxiliary", id: "auxiliary") {
AuxiliaryContentView()
}
#endif
}
}
struct DismissWindowButton: View {
@Environment(\.dismissWindow) private var dismissWindow
var body: some View {
Button("Close Auxiliary Window") {
dismissWindow(id: "auxiliary")
}
}
}
If the window was opened with ``EnvironmentValues/pushWindow``, the
presenting window will reappear when this action is performed.
get · iOS 16.0+sidebarRowSize
TypeScriptget sidebarRowSize(): SidebarRowSize
Swift declarationvar sidebarRowSize: SidebarRowSize { get set }
The current size of sidebar rows.
On macOS, reflects the value of the "Sidebar icon size" in
System Settings' Appearance settings.
This can be used to update the content shown in the sidebar in
response to this size. And it can be overridden to force a sidebar to a
particularly size, regardless of the user preference.
On other platforms, the value is always `.medium` and setting a
different value has no effect.
SwiftUI views like `Label` automatically adapt to the sidebar row size.
set · iOS 16.0+sidebarRowSize
TypeScriptset sidebarRowSize(value: SidebarRowSize)
Swift declarationvar sidebarRowSize: SidebarRowSize { get set }
The current size of sidebar rows.
On macOS, reflects the value of the "Sidebar icon size" in
System Settings' Appearance settings.
This can be used to update the content shown in the sidebar in
response to this size. And it can be overridden to force a sidebar to a
particularly size, regardless of the user preference.
On other platforms, the value is always `.medium` and setting a
different value has no effect.
SwiftUI views like `Label` automatically adapt to the sidebar row size.
get · iOS 17.0+badgeProminence
TypeScriptget badgeProminence(): BadgeProminence
Swift declarationvar badgeProminence: BadgeProminence { get set }
The prominence to apply to badges associated with this environment.
The default is ``BadgeProminence/standard``.
set · iOS 17.0+badgeProminence
TypeScriptset badgeProminence(value: BadgeProminence)
Swift declarationvar badgeProminence: BadgeProminence { get set }
The prominence to apply to badges associated with this environment.
The default is ``BadgeProminence/standard``.
get · iOS 17.0+isSceneCaptured
TypeScriptget isSceneCaptured(): boolean
Swift declarationvar isSceneCaptured: Bool { get set }
The current capture state.
Use this value to determine whether the scene is actively being cloned
to another destination (like during AirPlay) or is being mirrored or
recorded.
Your app can respond to changes in this value to take appropriate action,
like obscuring content.
set · iOS 17.0+isSceneCaptured
TypeScriptset isSceneCaptured(value: boolean)
Swift declarationvar isSceneCaptured: Bool { get set }
The current capture state.
Use this value to determine whether the scene is actively being cloned
to another destination (like during AirPlay) or is being mirrored or
recorded.
Your app can respond to changes in this value to take appropriate action,
like obscuring content.
get · iOS 16.0+isScrollEnabled
TypeScriptget isScrollEnabled(): boolean
Swift declarationvar isScrollEnabled: Bool { get set }
A Boolean value that indicates whether any scroll views associated
with this environment allow scrolling to occur.
The default value is `true`. Use the ``View/scrollDisabled(_:)``
modifier to configure this property.
set · iOS 16.0+isScrollEnabled
TypeScriptset isScrollEnabled(value: boolean)
Swift declarationvar isScrollEnabled: Bool { get set }
A Boolean value that indicates whether any scroll views associated
with this environment allow scrolling to occur.
The default value is `true`. Use the ``View/scrollDisabled(_:)``
modifier to configure this property.
get · iOS 18.0+tabBarPlacement
TypeScriptget tabBarPlacement(): (TabBarPlacement) | null
Swift declarationvar tabBarPlacement: TabBarPlacement? { get }
The current placement of the tab bar.
Note that this value is only set within the
content views of a ``TabView``.
A `nil` value corresponds to an undefined placement.
get · iOS 15.0+keyboardShortcut
TypeScriptget keyboardShortcut(): (KeyboardShortcut) | null
Swift declarationvar keyboardShortcut: KeyboardShortcut? { get }
The keyboard shortcut that buttons in this environment will be triggered
with.
This is particularly useful in button styles when a button's appearance
depends on the shortcut associated with it. On macOS, for example, when
a button is bound to the Return key, it is typically drawn with a
special emphasis. This happens automatically when using the built-in
button styles, and can be implemented manually in custom styles using
this environment key:
private struct MyButtonStyle: ButtonStyle {
@Environment(\.keyboardShortcut)
private var shortcut: KeyboardShortcut?
func makeBody(configuration: Configuration) -> some View {
let labelFont = Font.body
.weight(shortcut == .defaultAction ? .bold : .regular)
configuration.label
.font(labelFont)
}
}
If no keyboard shortcut has been applied to the view or its ancestor,
then the environment value will be `nil`.
get · iOS 18.0+labelsVisibility
TypeScriptget labelsVisibility(): _SwiftUICore_Visibility
Swift declarationvar labelsVisibility: Visibility { get set }
The labels visibility set by ``View/labelsVisibility(_:)``.
Read this environment value from within a view to obtain the preferred
visibility for labels within the hierarchy. If you would like to
dynamically hide the label of your custom view, make sure to include an
accessibility label via the ``View/accessibilityLabel(content:)``
modifier as illustrated below:
@Environment(\.labelsVisibility)
private var labelsVisibility
var body: some View {
VStack {
QuizCardView()
if labelsVisibility != .hidden {
label
}
}
.accessibilityLabel {
label
}
}
private var label: some View {
Text("Quiz Card")
}
set · iOS 18.0+labelsVisibility
TypeScriptset labelsVisibility(value: _SwiftUICore_Visibility)
Swift declarationvar labelsVisibility: Visibility { get set }
The labels visibility set by ``View/labelsVisibility(_:)``.
Read this environment value from within a view to obtain the preferred
visibility for labels within the hierarchy. If you would like to
dynamically hide the label of your custom view, make sure to include an
accessibility label via the ``View/accessibilityLabel(content:)``
modifier as illustrated below:
@Environment(\.labelsVisibility)
private var labelsVisibility
var body: some View {
VStack {
QuizCardView()
if labelsVisibility != .hidden {
label
}
}
.accessibilityLabel {
label
}
}
private var label: some View {
Text("Quiz Card")
}
get · iOS 13.0+ · Deprecated in iOS 100000.0presentationMode
TypeScriptget presentationMode(): _SwiftUICore_Binding<PresentationMode>
Swift declarationvar presentationMode: Binding<PresentationMode> { get }
A binding to the current presentation mode of the view associated with
this environment.
get · iOS 18.0+toolbarLabelStyle
TypeScriptget toolbarLabelStyle(): (ToolbarLabelStyle) | null
Swift declarationvar toolbarLabelStyle: ToolbarLabelStyle? { get }
The label style to apply to controls within a toolbar.
The default is `nil` for items outside the window toolbar.
get · iOS 17.0+buttonRepeatBehavior
TypeScriptget buttonRepeatBehavior(): ButtonRepeatBehavior
Swift declarationvar buttonRepeatBehavior: ButtonRepeatBehavior { get }
Whether buttons with this associated environment should repeatedly
trigger their actions on prolonged interactions.
A value of `enabled` means that buttons will be able to repeatedly
trigger their action, and `disabled` means they should not. A value of
`automatic` means that buttons will defer to default behavior.
get · iOS 17.0+isFocusEffectEnabled
TypeScriptget isFocusEffectEnabled(): boolean
Swift declarationvar isFocusEffectEnabled: Bool { get set }
A Boolean value that indicates whether the view associated with this
environment allows focus effects to be displayed.
The default value is `true`.
set · iOS 17.0+isFocusEffectEnabled
TypeScriptset isFocusEffectEnabled(value: boolean)
Swift declarationvar isFocusEffectEnabled: Bool { get set }
A Boolean value that indicates whether the view associated with this
environment allows focus effects to be displayed.
The default value is `true`.
get · iOS 13.0+managedObjectContext
TypeScriptget managedObjectContext(): _CoreData_NSManagedObjectContext
Swift declarationvar managedObjectContext: NSManagedObjectContext { get set }
set · iOS 13.0+managedObjectContext
TypeScriptset managedObjectContext(value: _CoreData_NSManagedObjectContext)
Swift declarationvar managedObjectContext: NSManagedObjectContext { get set }
get · iOS 26.0+supportsRemoteScenes
TypeScriptget supportsRemoteScenes(): boolean
Swift declarationvar supportsRemoteScenes: Bool { get }
Indicates if the current device supports presenting a
``RemoteImmersiveSpace`` on a remote device.
Use this to provide affordances for displaying your app's content on a
remote device.
struct NewSolarSystemImmersiveSpaceButton: View {
@Environment(\.openImmersiveSpace) private var openImmersiveSpace
@Environment(\.supportsRemoteScenes) private var supportsRemoteScenes
var body: some View {
Button("Present Solar System") {
Task {
await openImmersiveSpace(id: "solarSystem")
}
}
.disabled(!supportsRemoteScenes)
.help(!supportsRemoteScenes
? "Presenting remote scenes is not supported on this device."
: "")
}
}
get · iOS 18.0+writingToolsBehavior
TypeScriptget writingToolsBehavior(): (WritingToolsBehavior) | null
Swift declarationvar writingToolsBehavior: WritingToolsBehavior? { get }
The current Writing Tools behavior for text and text input.
This can be used by views that provide a custom text input to determine
the Writing Tools editing experience to provide.
get · iOS 13.0+ · Deprecated in iOS 100000.0disableAutocorrection
TypeScriptget disableAutocorrection(): (boolean) | null
Swift declarationvar disableAutocorrection: Bool? { get set }
A Boolean value that determines whether the view hierarchy has
auto-correction enabled.
When the value is `nil`, SwiftUI uses the system default. The default
value is `nil`.
set · iOS 13.0+ · Deprecated in iOS 100000.0disableAutocorrection
TypeScriptset disableAutocorrection(value: (boolean) | null)
Swift declarationvar disableAutocorrection: Bool? { get set }
A Boolean value that determines whether the view hierarchy has
auto-correction enabled.
When the value is `nil`, SwiftUI uses the system default. The default
value is `nil`.
get · iOS 17.0+documentConfiguration
TypeScriptget documentConfiguration(): (DocumentConfiguration) | null
Swift declarationvar documentConfiguration: DocumentConfiguration? { get }
The configuration of a document in a ``DocumentGroup``.
The value is `nil` for views that are not enclosed in a ``DocumentGroup``.
For example, if the app shows the document path in the footer
of each document, it can get the URL from the environment:
struct ContentView: View {
@Binding var document: TextDocument
@Environment(\.documentConfiguration) private var configuration: DocumentConfiguration?
var body: some View {
…
Label(
configuration?.fileURL?.path ??
"", systemImage: "folder.circle"
)
}
}
get · iOS 17.0+springLoadingBehavior
TypeScriptget springLoadingBehavior(): SpringLoadingBehavior
Swift declarationvar springLoadingBehavior: SpringLoadingBehavior { get }
The behavior of spring loaded interactions for the views associated
with this environment.
Spring loading refers to a view being activated during a drag and drop
interaction. On iOS this can occur when pausing briefly on top of a
view with dragged content. On macOS this can occur with similar brief
pauses or on pressure-sensitive systems by "force clicking" during the
drag. This has no effect on tvOS or watchOS.
This is commonly used with views that have a navigation or presentation
effect, allowing the destination to be revealed without pausing the
drag interaction. For example, a button that reveals a list of folders
that a dragged item can be dropped onto.
A value of `enabled` means that a view should support spring loaded
interactions if it is able, and `disabled` means it should not.
A value of `automatic` means that a view should follow its default
behavior, such as a `TabView` automatically allowing spring loading,
but a `Picker` with `segmented` style would not.
get · iOS 18.0+textSelectionAffinity
TypeScriptget textSelectionAffinity(): TextSelectionAffinity
Swift declarationvar textSelectionAffinity: TextSelectionAffinity { get set }
A representation of the direction or association of a selection or cursor
relative to a text character. This concept becomes much more prominent
when dealing with bidirectional text (text that contains both LTR and RTL
scripts, like English and Arabic combined).
You can configure the selection affinity on a given hierarchy by using
the ``View/textSelectionAffinity(_:)`` modifier.
set · iOS 18.0+textSelectionAffinity
TypeScriptset textSelectionAffinity(value: TextSelectionAffinity)
Swift declarationvar textSelectionAffinity: TextSelectionAffinity { get set }
A representation of the direction or association of a selection or cursor
relative to a text character. This concept becomes much more prominent
when dealing with bidirectional text (text that contains both LTR and RTL
scripts, like English and Arabic combined).
You can configure the selection affinity on a given hierarchy by using
the ``View/textSelectionAffinity(_:)`` modifier.
get · iOS 13.0+autocorrectionDisabled
TypeScriptget autocorrectionDisabled(): boolean
Swift declaration@export(implementation) var autocorrectionDisabled: Bool { get set }
A Boolean value that determines whether the view hierarchy has
auto-correction enabled.
The default value is `false`.
set · iOS 13.0+autocorrectionDisabled
TypeScriptset autocorrectionDisabled(value: boolean)
Swift declaration@export(implementation) var autocorrectionDisabled: Bool { get set }
A Boolean value that determines whether the view hierarchy has
auto-correction enabled.
The default value is `false`.
get · iOS 26.0+labelReservedIconWidth
TypeScriptget labelReservedIconWidth(): (number) | null
Swift declarationvar labelReservedIconWidth: CGFloat? { get }
The width reserved for icons in labels.
The value that should be used for the reserved icon width in labels.
To set a different value for labels, use the `labelReservedIconWidth`
modifier.
This environment value can be used in custom label styles to allow
changing the reserved icon width using the `labelReservedIconWidth`
modifier. If the value is `nil`, a default behavior to size the icon
should be used instead.
get · iOS 13.0+defaultMinListRowHeight
TypeScriptget defaultMinListRowHeight(): number
Swift declarationvar defaultMinListRowHeight: CGFloat { get set }
The default minimum height of rows in a list.
The height of list rows is bounded below by this default value, and is
otherwise determined by the height of the row's content and the row
insets.
set · iOS 13.0+defaultMinListRowHeight
TypeScriptset defaultMinListRowHeight(value: number)
Swift declarationvar defaultMinListRowHeight: CGFloat { get set }
The default minimum height of rows in a list.
The height of list rows is bounded below by this default value, and is
otherwise determined by the height of the row's content and the row
insets.
get · iOS 18.0+isTabBarShowingSections
TypeScriptget isTabBarShowingSections(): boolean
Swift declarationvar isTabBarShowingSections: Bool { get }
A Boolean value that determines whether a tab view shows the
expanded contents of a tab section.
get · iOS 26.0+labelIconToTitleSpacing
TypeScriptget labelIconToTitleSpacing(): (number) | null
Swift declarationvar labelIconToTitleSpacing: CGFloat? { get }
The spacing between the icon and title of a label.
The value that should be used for the icon-to-title spacing in labels.
To set a different value for labels, use the `labelIconToTitleSpacing`
modifier.
This environment value can be used in custom label styles to allow
changing the icon-to-title spacing using the `labelIconToTitleSpacing`
modifier. If the value is `nil`, a default value should be used instead.
get · iOS 15.0+menuIndicatorVisibility
TypeScriptget menuIndicatorVisibility(): _SwiftUICore_Visibility
Swift declarationvar menuIndicatorVisibility: Visibility { get set }
The menu indicator visibility to apply to controls within a view.
- Note: On tvOS, the standard button styles do not include a menu
indicator, so this modifier will have no effect when using a
built-in button style. You can implement an indicator in your
own ``ButtonStyle`` implementation by checking the value of this
environment value.
set · iOS 15.0+menuIndicatorVisibility
TypeScriptset menuIndicatorVisibility(value: _SwiftUICore_Visibility)
Swift declarationvar menuIndicatorVisibility: Visibility { get set }
The menu indicator visibility to apply to controls within a view.
- Note: On tvOS, the standard button styles do not include a menu
indicator, so this modifier will have no effect when using a
built-in button style. You can implement an indicator in your
own ``ButtonStyle`` implementation by checking the value of this
environment value.
get · iOS 16.0+supportsMultipleWindows
TypeScriptget supportsMultipleWindows(): boolean
Swift declarationvar supportsMultipleWindows: Bool { get }
A Boolean value that indicates whether the current platform supports
opening multiple windows.
Read this property from the environment to determine if your app can
use the ``EnvironmentValues/openWindow`` action to open new windows:
struct NewMailViewerButton: View {
@Environment(\.supportsMultipleWindows) private var supportsMultipleWindows
@Environment(\.openWindow) private var openWindow
var body: some View {
Button("Open New Window") {
openWindow(id: "mail-viewer")
}
.disabled(!supportsMultipleWindows)
}
}
The reported value depends on both the platform and how you configure
your app:
* In macOS, this property returns `true` for any app that uses the
SwiftUI app lifecycle.
* In iPadOS, this property returns `true` for any app that uses the
SwiftUI app lifecycle and has the Information Property List key
<doc://com.apple.documentation/documentation/BundleResources/Information-Property-List/UIApplicationSceneManifest/UIApplicationSupportsMultipleScenes> set to `true`.
* For all other platforms and configurations, the value returns `false`.
If the value is false and you try to open a window, SwiftUI
ignores the action and logs a runtime error.
get · iOS 27.0+isTabViewSidebarAvailable
TypeScriptget isTabViewSidebarAvailable(): boolean
Swift declarationvar isTabViewSidebarAvailable: Bool { get }
A Boolean value that indicates whether a tab sidebar is available
within the content of a surrounding ``TabView``.
This value is only meaningful inside the content views of a
``TabView`` that uses a sidebar-capable style such as
``TabViewStyle/sidebarAdaptable``. Reading it from a view that is
not nested inside a `TabView`'s content — for example, a view
above the `TabView` in the hierarchy — returns `false`.
struct ContentView: View {
var body: some View {
TabView {
Tab("Home", systemImage: "house") {
HomeTab()
}
}
.tabViewStyle(.sidebarAdaptable)
}
}
struct HomeTab: View {
@Environment(\.isTabViewSidebarAvailable)
private var isTabViewSidebarAvailable
var body: some View {
if isTabViewSidebarAvailable {
// Sidebar is (or can become) visible — adjust UI.
} else {
// No sidebar in this context.
}
}
}
Use this value to gate behaviors or UI that depend on the
sidebar's availability, rather than inspecting size classes
directly.
get · iOS 13.0+defaultMinListHeaderHeight
TypeScriptget defaultMinListHeaderHeight(): (number) | null
Swift declarationvar defaultMinListHeaderHeight: CGFloat? { get set }
The default minimum height of a header in a list.
When this value is `nil`, the system chooses the appropriate height. The
default is `nil`.
set · iOS 13.0+defaultMinListHeaderHeight
TypeScriptset defaultMinListHeaderHeight(value: (number) | null)
Swift declarationvar defaultMinListHeaderHeight: CGFloat? { get set }
The default minimum height of a header in a list.
When this value is `nil`, the system chooses the appropriate height. The
default is `nil`.
get · iOS 16.0+searchSuggestionsPlacement
TypeScriptget searchSuggestionsPlacement(): SearchSuggestionsPlacement
Swift declarationvar searchSuggestionsPlacement: SearchSuggestionsPlacement { get }
The current placement of search suggestions.
Search suggestions render based on the platform and surrounding context
in which you place the searchable modifier containing suggestions.
You can render search suggestions in two ways:
* In a menu attached to the search field.
* Inline with the main content of the app.
You find the current search suggestion placement by querying the
``EnvironmentValues/searchSuggestionsPlacement`` in your
search suggestions.
enum FruitSuggestion: String, Identifiable {
case apple, banana, orange
var id: Self { self }
}
@State private var text: String = ""
@State private var suggestions: [FruitSuggestion] = []
var body: some View {
MainContent()
.searchable(text: $text) {
FruitSuggestions(suggestions: suggestions)
}
}
struct FruitSuggestions: View {
var suggestions: [FruitSuggestion]
@Environment(\.searchSuggestionsPlacement)
private var placement
var body: some View {
if shouldRender {
ForEach(suggestions) { suggestion in
Text(suggestion.rawValue.capitalized)
.searchCompletion(suggestion.rawValue)
}
}
}
var shouldRender: Bool {
#if os(iOS)
placement == .menu
#else
true
#endif
}
}
In the above example, search suggestions only render in iOS
if the searchable modifier displays them in a menu. You might want
to do this to render suggestions in your own list alongside
your own search results when they would render in a list.
get · iOS 18.0+isUserAuthenticationEnabled
TypeScriptget isUserAuthenticationEnabled(): boolean
Swift declarationvar isUserAuthenticationEnabled: Bool { get }
The current system user authentication enablement status.
Use this value to determine whether the system will issue additional device-owner
authentication challenges before revealing this piece of user interface
from under a system-installed shield.
Your app can respond to changes in this value to take appropriate action,
like installing or uninstalling a bespoke UI shield for sensitive content.
get · iOS 16.0+scrollDismissesKeyboardMode
TypeScriptget scrollDismissesKeyboardMode(): ScrollDismissesKeyboardMode
Swift declarationvar scrollDismissesKeyboardMode: ScrollDismissesKeyboardMode { get set }
The way that scrollable content interacts with the software keyboard.
The default value is ``ScrollDismissesKeyboardMode/automatic``. Use the
``View/scrollDismissesKeyboard(_:)`` modifier to configure this
property.
set · iOS 16.0+scrollDismissesKeyboardMode
TypeScriptset scrollDismissesKeyboardMode(value: ScrollDismissesKeyboardMode)
Swift declarationvar scrollDismissesKeyboardMode: ScrollDismissesKeyboardMode { get set }
The way that scrollable content interacts with the software keyboard.
The default value is ``ScrollDismissesKeyboardMode/automatic``. Use the
``View/scrollDismissesKeyboard(_:)`` modifier to configure this
property.
get · iOS 17.5+preferredPencilSqueezeAction
TypeScriptget preferredPencilSqueezeAction(): PencilPreferredAction
Swift declarationvar preferredPencilSqueezeAction: PencilPreferredAction { get }
The action that the user prefers to perform when squeezing their Apple
Pencil, as selected in the Settings app.
You can read this value by creating a property with the ``Environment``
property wrapper and using it inside the action closure of the
``View/onPencilSqueeze(perform:)`` view modifier as an indication of
what to do when the user squeezes their Apple Pencil:
```
@Environment(\.preferredPencilSqueezeAction) private var preferredAction
var body: some View {
MyDrawingCanvas()
.onPencilSqueeze { phase in
switch (phase, preferredAction) {
...
}
}
}
```
In macOS, this value cannot be changed by users and is always set to
``PencilPreferredAction/showContextualPalette``.
get · iOS 16.4+verticalScrollBounceBehavior
TypeScriptget verticalScrollBounceBehavior(): ScrollBounceBehavior
Swift declarationvar verticalScrollBounceBehavior: ScrollBounceBehavior { get set }
The scroll bounce mode for the vertical axis of scrollable views.
Use the ``View/scrollBounceBehavior(_:axes:)`` view modifier to set this
value in the ``Environment``.
set · iOS 16.4+verticalScrollBounceBehavior
TypeScriptset verticalScrollBounceBehavior(value: ScrollBounceBehavior)
Swift declarationvar verticalScrollBounceBehavior: ScrollBounceBehavior { get set }
The scroll bounce mode for the vertical axis of scrollable views.
Use the ``View/scrollBounceBehavior(_:axes:)`` view modifier to set this
value in the ``Environment``.
get · iOS 16.4+horizontalScrollBounceBehavior
TypeScriptget horizontalScrollBounceBehavior(): ScrollBounceBehavior
Swift declarationvar horizontalScrollBounceBehavior: ScrollBounceBehavior { get set }
The scroll bounce mode for the horizontal axis of scrollable views.
Use the ``View/scrollBounceBehavior(_:axes:)`` view modifier to set this
value in the ``Environment``.
set · iOS 16.4+horizontalScrollBounceBehavior
TypeScriptset horizontalScrollBounceBehavior(value: ScrollBounceBehavior)
Swift declarationvar horizontalScrollBounceBehavior: ScrollBounceBehavior { get set }
The scroll bounce mode for the horizontal axis of scrollable views.
Use the ``View/scrollBounceBehavior(_:axes:)`` view modifier to set this
value in the ``Environment``.
get · iOS 17.5+preferredPencilDoubleTapAction
TypeScriptget preferredPencilDoubleTapAction(): PencilPreferredAction
Swift declarationvar preferredPencilDoubleTapAction: PencilPreferredAction { get }
The action that the user prefers to perform after double-tapping their
Apple Pencil, as selected in the Settings app.
You can read this value by creating a property with the ``Environment``
property wrapper and using it inside the action closure of the
``View/onPencilDoubleTap(perform:)`` view modifier as an indication of
what to do after the user double-taps their Apple Pencil:
```
@Environment(\.preferredPencilDoubleTapAction) private var preferredAction
var body: some View {
MyDrawingCanvas()
.onPencilDoubleTap { value in
switch preferredAction {
...
}
}
}
```
In macOS, this value cannot be changed by users and is always set to
``PencilPreferredAction/switchEraser``.
get · iOS 26.0+tabViewBottomAccessoryPlacement
TypeScriptget tabViewBottomAccessoryPlacement(): (TabViewBottomAccessoryPlacement) | null
Swift declarationvar tabViewBottomAccessoryPlacement: TabViewBottomAccessoryPlacement? { get }
The current placement of the tab view bottom accessory.
A `nil` value corresponds to an undefined placement.
get · iOS 16.0+accessibilityQuickActionsEnabled
TypeScriptget accessibilityQuickActionsEnabled(): boolean
Swift declarationvar accessibilityQuickActionsEnabled: Bool { get }
A Boolean that indicates whether the quick actions feature is enabled.
The system uses quick actions to provide users with a
fast alternative interaction method. Quick actions can be
presented to users with a textual banner at the top of their
screen and/or an outline around a view that is already on screen.
get · iOS 17.0+navigationLinkIndicatorVisibility
TypeScriptget navigationLinkIndicatorVisibility(): _SwiftUICore_Visibility
Swift declaration@export(implementation) var navigationLinkIndicatorVisibility: Visibility { get }
A value that says whether a built-in navigation link would show a
disclosure indicator in the current context.
You can set this value with ``View/navigationLinkIndicatorVisibility(_:)``.
get · iOS 27.0+systemPrefersReducedResourceUsage
TypeScriptget systemPrefersReducedResourceUsage(): boolean
Swift declarationvar systemPrefersReducedResourceUsage: Bool { get set }
A boolean value indicating whether the system would prefer the app to
reduce its overall resource usage.
When this value is `true`, the system has entered a state where it would
prefer apps to scale back resource-intensive work. The default value is
`false`.
Use this to avoid or reduce expensive work. For example:
- Gate or simplify resource-intensive UI, such as 3D or AR viewers,
advanced camera modes, or live effects.
- Choose lighter-weight paths, such as lower-resolution assets or fewer
simultaneous operations.
- Defer or shrink non-essential background work, such as prefetching or
precomputation.
Avoid performing or scheduling expensive work in response to changes in
this property, as this could worsen resource usage.
- Tip: For in-memory caching, consider using ``NSCache`` with
``NSPurgeableData``, which automatically evicts entries under system
memory pressure. Use `systemPrefersReducedResourceUsage` for
higher-level decisions that ``NSCache`` cannot make on its own.
When accessed outside in an `App` or `Scene` struct, this defaults to an
app-wide aggregate value based on all scenes.
set · iOS 27.0+systemPrefersReducedResourceUsage
TypeScriptset systemPrefersReducedResourceUsage(value: boolean)
Swift declarationvar systemPrefersReducedResourceUsage: Bool { get set }
A boolean value indicating whether the system would prefer the app to
reduce its overall resource usage.
When this value is `true`, the system has entered a state where it would
prefer apps to scale back resource-intensive work. The default value is
`false`.
Use this to avoid or reduce expensive work. For example:
- Gate or simplify resource-intensive UI, such as 3D or AR viewers,
advanced camera modes, or live effects.
- Choose lighter-weight paths, such as lower-resolution assets or fewer
simultaneous operations.
- Defer or shrink non-essential background work, such as prefetching or
precomputation.
Avoid performing or scheduling expensive work in response to changes in
this property, as this could worsen resource usage.
- Tip: For in-memory caching, consider using ``NSCache`` with
``NSPurgeableData``, which automatically evicts entries under system
memory pressure. Use `systemPrefersReducedResourceUsage` for
higher-level decisions that ``NSCache`` cannot make on its own.
When accessed outside in an `App` or `Scene` struct, this defaults to an
app-wide aggregate value based on all scenes.
get · iOS 16.0+verticalScrollIndicatorVisibility
TypeScriptget verticalScrollIndicatorVisibility(): ScrollIndicatorVisibility
Swift declarationvar verticalScrollIndicatorVisibility: ScrollIndicatorVisibility { get set }
The visiblity to apply to scroll indicators of any
vertically scrollable content.
set · iOS 16.0+verticalScrollIndicatorVisibility
TypeScriptset verticalScrollIndicatorVisibility(value: ScrollIndicatorVisibility)
Swift declarationvar verticalScrollIndicatorVisibility: ScrollIndicatorVisibility { get set }
The visiblity to apply to scroll indicators of any
vertically scrollable content.
get · iOS 16.0+horizontalScrollIndicatorVisibility
TypeScriptget horizontalScrollIndicatorVisibility(): ScrollIndicatorVisibility
Swift declarationvar horizontalScrollIndicatorVisibility: ScrollIndicatorVisibility { get set }
The visibility to apply to scroll indicators of any
horizontally scrollable content.
set · iOS 16.0+horizontalScrollIndicatorVisibility
TypeScriptset horizontalScrollIndicatorVisibility(value: ScrollIndicatorVisibility)
Swift declarationvar horizontalScrollIndicatorVisibility: ScrollIndicatorVisibility { get set }
The visibility to apply to scroll indicators of any
horizontally scrollable content.
get · iOS 16.0+rename
TypeScriptget rename(): (RenameAction) | null
Swift declarationvar rename: RenameAction? { get }
An action that activates the standard rename interaction.
Use the ``View/renameAction(_:)`` modifier to configure the rename
action in the environment.
get · iOS 15.0+dismiss
TypeScriptget dismiss(): DismissAction
Swift declarationvar dismiss: DismissAction { get }
An action that dismisses the current presentation.
Use this environment value to get the ``DismissAction`` instance
for the current ``Environment``. Then call the instance
to perform the dismissal. You call the instance directly because
it defines a ``DismissAction/callAsFunction()``
method that Swift calls when you call the instance.
You can use this action to:
* Dismiss a modal presentation, like a sheet or a popover.
* Pop the current view from a ``NavigationStack``.
On apps targetting iOS 18 and aligned releases, you also use the
dismiss action to pop the implicit stack of a collapsed
``NavigationSplitView``, or clear the equivalent state in an expanded
split view.
The specific behavior of the action depends on where you call it from.
For example, you can create a button that calls the ``DismissAction``
inside a view that acts as a sheet:
private struct SheetContents: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
Button("Done") {
dismiss()
}
}
}
When you present the `SheetContents` view, someone can dismiss
the sheet by tapping or clicking the sheet's button:
private struct DetailView: View {
@State private var isSheetPresented = false
var body: some View {
Button("Show Sheet") {
isSheetPresented = true
}
.sheet(isPresented: $isSheetPresented) {
SheetContents()
}
}
}
Be sure that you define the action in the appropriate environment.
For example, don't reorganize the `DetailView` in the example above
so that it creates the `dismiss` property and calls it from the
``View/sheet(item:onDismiss:content:)`` view modifier's `content`
closure:
private struct DetailView: View {
@State private var isSheetPresented = false
@Environment(\.dismiss) private var dismiss // Applies to DetailView.
var body: some View {
Button("Show Sheet") {
isSheetPresented = true
}
.sheet(isPresented: $isSheetPresented) {
Button("Done") {
dismiss() // Fails to dismiss the sheet.
}
}
}
}
If you do this, the sheet fails to dismiss because the action applies
to the environment where you declared it, which is that of the detail
view, rather than the sheet. In fact, in macOS and iPadOS, if the
`DetailView` is the root view of a window, the dismiss action closes
the window instead.
The dismiss action has no effect on a view that isn't currently
presented. If you need to query whether SwiftUI is currently presenting
a view, read the ``EnvironmentValues/isPresented`` environment value.
- Note: While the dismiss action can be used to a close window that you
create with ``WindowGroup`` or ``Window``, prefer
``DismissWindowAction`` for that use case instead.
get · iOS 15.0+refresh
TypeScriptget refresh(): (RefreshAction) | null
Swift declarationvar refresh: RefreshAction? { get }
A refresh action stored in a view's environment.
When this environment value contains an instance of the
``RefreshAction`` structure, certain built-in views in the corresponding
``Environment`` begin offering a refresh capability. They apply the
instance's handler to any refresh operation that the user initiates.
By default, the environment value is `nil`, but you can use the
``View/refreshable(action:)`` modifier to create and store a new
refresh action that uses the handler that you specify:
List(mailbox.conversations) { conversation in
ConversationCell(conversation)
}
.refreshable {
await mailbox.fetch()
}
On iOS and iPadOS, the ``List`` in the example above offers a
pull to refresh gesture because it detects the refresh action. When
the user drags the list down and releases, the list calls the action's
handler. Because SwiftUI declares the handler as asynchronous, it can
safely make long-running asynchronous calls, like fetching network data.
### Refreshing custom views
You can also offer refresh capability in your custom views.
Read the `refresh` environment value to get the ``RefreshAction``
instance for a given ``Environment``. If you find
a non-`nil` value, change your view's appearance or behavior to offer
the refresh to the user, and call the instance to conduct the
refresh. You can call the refresh instance directly because it defines
a ``RefreshAction/callAsFunction()`` method that Swift calls
when you call the instance:
struct RefreshableView: View {
@Environment(\.refresh) private var refresh
var body: some View {
Button("Refresh") {
Task {
await refresh?()
}
}
.disabled(refresh == nil)
}
}
Be sure to call the handler asynchronously by preceding it
with `await`. Because the call is asynchronous, you can use
its lifetime to indicate progress to the user. For example,
you can reveal an indeterminate ``ProgressView`` before
calling the handler, and hide it when the handler completes.
If your code isn't already in an asynchronous context, create a
<doc://com.apple.documentation/documentation/Swift/Task> for the
method to run in. If you do this, consider adding a way for the
user to cancel the task. For more information, see
[Concurrency](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html)
in *The Swift Programming Language*.
get · iOS 13.0+editMode
TypeScriptget editMode(): (_SwiftUICore_Binding<EditMode>) | null
Swift declarationvar editMode: Binding<EditMode>? { get set }
An indication of whether the user can edit the contents of a view
associated with this environment.
Read this environment value to receive a optional binding to the
edit mode state. The binding contains an ``EditMode`` value
that indicates whether edit mode is active, and that you can use to
change the mode. To learn how to read an environment
value, see ``EnvironmentValues``.
Certain built-in views automatically alter their appearance and behavior
in edit mode. For example, a ``List`` with a ``ForEach`` that's
configured with the ``DynamicViewContent/onDelete(perform:)`` or
``DynamicViewContent/onMove(perform:)`` modifier provides controls to
delete or move list items while in edit mode. On devices without an
attached keyboard and mouse or trackpad, people can make multiple
selections in lists only when edit mode is active.
You can also customize your own views to react to edit mode.
The following example replaces a read-only ``Text`` view with
an editable ``TextField``, checking for edit mode by
testing the wrapped value's ``EditMode/isEditing`` property:
@Environment(\.editMode) private var editMode
@State private var name = "Maria Ruiz"
var body: some View {
Form {
if editMode?.wrappedValue.isEditing == true {
TextField("Name", text: $name)
} else {
Text(name)
}
}
.animation(nil, value: editMode?.wrappedValue)
.toolbar { // Assumes embedding this view in a NavigationView.
EditButton()
}
}
You can set the edit mode through the binding, or you can
rely on an ``EditButton`` to do that for you, as the example above
demonstrates. The button activates edit mode when the user
taps the Edit button, and disables editing mode when the user taps Done.
set · iOS 13.0+editMode
TypeScriptset editMode(value: (_SwiftUICore_Binding<EditMode>) | null)
Swift declarationvar editMode: Binding<EditMode>? { get set }
An indication of whether the user can edit the contents of a view
associated with this environment.
Read this environment value to receive a optional binding to the
edit mode state. The binding contains an ``EditMode`` value
that indicates whether edit mode is active, and that you can use to
change the mode. To learn how to read an environment
value, see ``EnvironmentValues``.
Certain built-in views automatically alter their appearance and behavior
in edit mode. For example, a ``List`` with a ``ForEach`` that's
configured with the ``DynamicViewContent/onDelete(perform:)`` or
``DynamicViewContent/onMove(perform:)`` modifier provides controls to
delete or move list items while in edit mode. On devices without an
attached keyboard and mouse or trackpad, people can make multiple
selections in lists only when edit mode is active.
You can also customize your own views to react to edit mode.
The following example replaces a read-only ``Text`` view with
an editable ``TextField``, checking for edit mode by
testing the wrapped value's ``EditMode/isEditing`` property:
@Environment(\.editMode) private var editMode
@State private var name = "Maria Ruiz"
var body: some View {
Form {
if editMode?.wrappedValue.isEditing == true {
TextField("Name", text: $name)
} else {
Text(name)
}
}
.animation(nil, value: editMode?.wrappedValue)
.toolbar { // Assumes embedding this view in a NavigationView.
EditButton()
}
}
You can set the edit mode through the binding, or you can
rely on an ``EditButton`` to do that for you, as the example above
demonstrates. The button activates edit mode when the user
taps the Edit button, and disables editing mode when the user taps Done.
get · iOS 14.0+isFocused
TypeScriptget isFocused(): boolean
Swift declarationvar isFocused: Bool { get }
Returns whether the nearest focusable ancestor has focus.
If there is no focusable ancestor, the value is `false`.
get · iOS 16.0+menuOrder
TypeScriptget menuOrder(): MenuOrder
Swift declarationvar menuOrder: MenuOrder { get set }
The preferred order of items for menus presented from this view.
Set this value for a view hierarchy by calling the
``View/menuOrder(_:)`` view modifier.
set · iOS 16.0+menuOrder
TypeScriptset menuOrder(value: MenuOrder)
Swift declarationvar menuOrder: MenuOrder { get set }
The preferred order of items for menus presented from this view.
Set this value for a view hierarchy by calling the
``View/menuOrder(_:)`` view modifier.
init · iOS 18.0+init
TypeScriptstatic initContentTypePrepareDocumentURL(title: _Foundation_LocalizedStringResource, contentType: _UniformTypeIdentifiers_UTType, prepareDocumentURL?: (() => Promise<(string) | null>)): Promise<NewDocumentButton<_SwiftUICore_Text>>
Swift declaration@export(implementation) nonisolated init(_ title: LocalizedStringResource, contentType: UTType, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new documents.
This initializer allows presenting a template picker,
where a document can be prepopulated or preconfigured using a template.
@State private var isTemplatePickerPresented = false
@State private var documentCreationContinuation:
CheckedContinuation<URL?, any Error>?
var body: some Scene {
DocumentGroupLaunchScene("My Documents") {
NewDocumentButton("Start Writing…")
NewDocumentButton("Choose a Template") {
try await withCheckedThrowingContinuation { continuation in
documentCreationContinuation = continuation
isTemplatePickerPresented = true
}
}
.fullScreenCover(isPresented: $isTemplatePickerPresented) {
TemplatePicker(
continuation: $documentCreationContinuation
)
}
}
DocumentGroup(newDocument: TextDocument()) { configuration in
MyDocumentView(document: configuration.$document))
}
}
struct TemplatePicker: View {
@Binding var continuation:
CheckedContinuation<URL?, any Error>?
@Environment(\.dismiss) var dismiss
var body: some View {
VStack {
Text("Choose a template")
.font(.title)
Button("Meeting minutes") {
let document = makeMeetingMinutes()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Letter") {
let document = makeLetter()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Cancel") {
documentCreationContinuation?.resume(throwing: CancellationError())
dismiss()
}
}
}
private func makeMeetingMinutes() -> URL { ... }
private func makeLetter() -> URL { ... }
}
- Parameters:
- title: A title resource for the button title.
- contentType: A content type of the document to create.
- prepareDocumentURL: A closure that is called when a user presses the
button. At this point, you can present a document template picker or
another UI that allows users to choose a theme, configuration, or a
template to create a document from.
Return a prepared document, or throw an error if document creation
failed.
Return `nil` to request creation of an empty document.
init · iOS 18.0+init
TypeScriptstatic initContentTypePrepareDocumentURL152(title: _SwiftUICore_LocalizedStringKey, contentType: _UniformTypeIdentifiers_UTType, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringKey, contentType: UTType, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new documents.
This initializer allows presenting a template picker,
where a document can be prepopulated or preconfigured using a template.
@State private var isTemplatePickerPresented = false
@State private var documentCreationContinuation:
CheckedContinuation<URL?, any Error>?
var body: some Scene {
DocumentGroupLaunchScene("My Documents") {
NewDocumentButton("Start Writing…")
NewDocumentButton("Choose a Template") {
try await withCheckedThrowingContinuation { continuation in
documentCreationContinuation = continuation
isTemplatePickerPresented = true
}
}
.fullScreenCover(isPresented: $isTemplatePickerPresented) {
TemplatePicker(
continuation: $documentCreationContinuation
)
}
}
DocumentGroup(newDocument: TextDocument()) { configuration in
MyDocumentView(document: configuration.$document))
}
}
struct TemplatePicker: View {
@Binding var continuation:
CheckedContinuation<URL?, any Error>?
@Environment(\.dismiss) var dismiss
var body: some View {
VStack {
Text("Choose a template")
.font(.title)
Button("Meeting minutes") {
let document = makeMeetingMinutes()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Letter") {
let document = makeLetter()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Cancel") {
documentCreationContinuation?.resume(throwing: CancellationError())
dismiss()
}
}
}
private func makeMeetingMinutes() -> URL { ... }
private func makeLetter() -> URL { ... }
}
- Parameters:
- title: A title key for the button title.
- contentType: A content type of the document to create.
- prepareDocumentURL: A closure that is called when a user presses the button.
At this point, you can present a document template picker or another UI that allows
users to choose a theme, configuration, or a template
to create a document from.
Return a prepared document, or throw an error if document creation failed.
Return `nil` to request creation of an empty document.
init · iOS 18.0+init
TypeScriptstatic initContentTypePrepareDocumentURL26306(label: (_SwiftUICore_Text) | null, contentType: _UniformTypeIdentifiers_UTType, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ label: Text? = nil, contentType: UTType, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new documents.
This initializer allows presenting a template picker,
where a document can be prepopulated or preconfigured using a template.
@State private var isTemplatePickerPresented = false
@State private var documentCreationContinuation:
CheckedContinuation<URL?, any Error>?
var body: some Scene {
DocumentGroupLaunchScene("My Documents") {
NewDocumentButton(Text("Start Writing…"))
NewDocumentButton(Text("Choose a Template")) {
try await withCheckedThrowingContinuation { continuation in
documentCreationContinuation = continuation
isTemplatePickerPresented = true
}
}
.fullScreenCover(isPresented: $isTemplatePickerPresented) {
TemplatePicker(
continuation: $documentCreationContinuation
)
}
}
DocumentGroup(newDocument: TextDocument()) { configuration in
MyDocumentView(document: configuration.$document))
}
}
struct TemplatePicker: View {
@Binding var continuation:
CheckedContinuation<URL?, any Error>?
@Environment(\.dismiss) var dismiss
var body: some View {
VStack {
Text("Choose a template")
.font(.title)
Button("Meeting minutes") {
let document = makeMeetingMinutes()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Letter") {
let document = makeLetter()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Cancel") {
documentCreationContinuation?.resume(throwing: CancellationError())
dismiss()
}
}
}
private func makeMeetingMinutes() -> URL { ... }
private func makeLetter() -> URL { ... }
}
- Parameters:
- label: A label for the button.
- contentType: A content type of the document to create.
- prepareDocumentURL: A closure that is called when a user presses the button.
At this point, you can present a document template picker or another UI that allows
users to choose a theme, configuration, or a template
to create a document from.
Return a prepared document, or throw an error if document creation failed.
Return `nil` to request creation of an empty document.
init · iOS 18.0+init
TypeScriptstatic initContentTypePrepareDocumentURL75260(title: SDKHandle, contentType: _UniformTypeIdentifiers_UTType, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: some StringProtocol, contentType: UTType, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new documents.
This initializer allows presenting a template picker,
where a document can be prepopulated or preconfigured using a template.
@State private var isTemplatePickerPresented = false
@State private var documentCreationContinuation:
CheckedContinuation<TextDocument?, any Error>?
var body: some Scene {
DocumentGroupLaunchScene("My Documents") {
NewDocumentButton("Start Writing…")
NewDocumentButton("Choose a Template", for: TextDocument.self) {
try await withCheckedThrowingContinuation { continuation in
documentCreationContinuation = continuation
isTemplatePickerPresented = true
}
}
.fullScreenCover(isPresented: $isTemplatePickerPresented) {
TemplatePicker(
continuation: $documentCreationContinuation
)
}
}
DocumentGroup(newDocument: TextDocument()) { configuration in
MyDocumentView(document: configuration.$document))
}
}
struct TemplatePicker: View {
@Binding var continuation:
CheckedContinuation<TextDocument?, any Error>?
var body: some View {
VStack {
Text("Choose a template")
.font(.title)
Button("Meeting minutes") {
let document = makeMeetingMinutes()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Letter") {
let document = makeLetter()
documentCreationContinuation?.resume(returning: document)
dismiss()
}
Button("Cancel") {
documentCreationContinuation?.resume(throwing: CancellationError())
dismiss()
}
}
}
private func makeMeetingMinutes() -> TextDocument { ... }
private func makeLetter() -> TextDocument { ... }
}
struct TextDocument: FileDocument { ... }
- Parameters:
- title: A title key for the button title.
- contentType: A content type of the document to create.
- prepareDocumentURL: A closure that is called when a user presses the button.
At this point, you can present a document template picker or another UI that allows
users to choose a theme, configuration, or a template
to create a document from.
Return a prepared document, or throw an error if document creation failed.
Return `nil` to request creation of an empty document.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSourcePrepareDocumentURL(title: _Foundation_LocalizedStringResource, contentType: _UniformTypeIdentifiers_UTType, source: DocumentCreationSource, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringResource, contentType: UTType, source: DocumentCreationSource, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new URL-based documents from a template picker.
- Parameters:
- title: A localized string resource for the button.
- contentType: The content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
- prepareDocumentURL: Called when the user taps the button.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSourcePrepareDocumentURL47011(title: _SwiftUICore_LocalizedStringKey, contentType: _UniformTypeIdentifiers_UTType, source: DocumentCreationSource, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringKey, contentType: UTType, source: DocumentCreationSource, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new URL-based documents from a template picker.
- Parameters:
- title: A title key for the button.
- contentType: The content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
- prepareDocumentURL: Called when the user taps the button.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSourcePrepareDocumentURL26363(title: SDKHandle, contentType: _UniformTypeIdentifiers_UTType, source: DocumentCreationSource, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: some StringProtocol, contentType: UTType, source: DocumentCreationSource, prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new URL-based documents from a template picker.
- Parameters:
- title: A title string for the button.
- contentType: The content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
- prepareDocumentURL: Called when the user taps the button.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSource(title: _Foundation_LocalizedStringResource, contentType: (_UniformTypeIdentifiers_UTType) | null, source: DocumentCreationSource): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringResource, contentType: UTType? = nil, source: DocumentCreationSource)
Creates and opens new documents, tagging them with a creation source.
- Parameters:
- title: A localized string resource to use as the button title.
- contentType: An optional content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSource10053(title: _SwiftUICore_LocalizedStringKey, contentType: (_UniformTypeIdentifiers_UTType) | null, source: DocumentCreationSource): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringKey, contentType: UTType? = nil, source: DocumentCreationSource)
Creates and opens new documents, tagging them with a creation source.
- Parameters:
- title: A title key to use as the button title.
- contentType: An optional content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSource86793(label: (_SwiftUICore_Text) | null, contentType: (_UniformTypeIdentifiers_UTType) | null, source: DocumentCreationSource): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ label: Text? = nil, contentType: UTType? = nil, source: DocumentCreationSource)
Creates and opens new documents, tagging them with a creation source.
extension DocumentCreationSource {
static let brainstorming: Self =
DocumentCreationSource(id: "brainstorming")
}
DocumentGroupLaunchScene("Meeting Minutes") {
NewDocumentButton(Text("New meeting minutes…"))
NewDocumentButton(
Text("New brainstorming meeting…"),
source: .brainstorming
)
}
- Parameters:
- label: A label for the button.
- contentType: An optional content type of the document to create.
If not provided, the first content type of the first document type
listed in the app definition is used.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSource56971(title: SDKHandle, contentType: (_UniformTypeIdentifiers_UTType) | null, source: DocumentCreationSource): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: some StringProtocol, contentType: UTType? = nil, source: DocumentCreationSource)
Creates and opens new documents, tagging them with a creation source.
- Parameters:
- title: A title string to use as the button title.
- contentType: An optional content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
init · iOS 27.0+init
TypeScriptstatic initContentTypeSource39347(label: (_SwiftUICore_Text) | null, contentType: _UniformTypeIdentifiers_UTType, source: DocumentCreationSource, prepareDocumentURL?: (() => Promise<(string) | null>)): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ label: Text? = nil, contentType: UTType, source: DocumentCreationSource, _ prepareDocumentURL: @escaping () async throws -> URL? = { nil })
Creates and opens new URL-based documents from a template picker.
NewDocumentButton(
contentType: .text,
source: .template
) {
try await withCheckedThrowingContinuation { continuation in
documentCreationContinuation = continuation
showTemplatePicker = true
}
}
- Parameters:
- label: A label for the button.
- contentType: The content type of the document to create.
- source: A source for the document creation flow. When a document is
created, you can retrieve its source from ``FileDocumentConfiguration``
or ``URLDocumentConfiguration``.
- prepareDocumentURL: Called when the user taps the button. Present
a template picker or other UI, then return the URL of the prepared
document, `nil` to request an empty document, or throw on
cancellation.
init · iOS 18.0+init
TypeScriptstatic initContentType(title: _Foundation_LocalizedStringResource, contentType?: (_UniformTypeIdentifiers_UTType) | null): NewDocumentButton<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ title: LocalizedStringResource, contentType: UTType? = nil)
Creates and opens new documents.
- Parameters:
- title: A title resource to use as the button title.
- contentType: An optional content type of the document to create.
init · iOS 18.0+init
TypeScriptstatic initContentType79411(title: _SwiftUICore_LocalizedStringKey, contentType?: (_UniformTypeIdentifiers_UTType) | null): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: LocalizedStringKey, contentType: UTType? = nil)
Creates and opens new documents.
- Parameters:
- title: A title key to use as the button title.
- contentType: An optional content type of the document to create.
init · iOS 18.0+init
TypeScriptstatic initContentType30773(label?: (_SwiftUICore_Text) | null, contentType?: (_UniformTypeIdentifiers_UTType) | null): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ label: Text? = nil, contentType: UTType? = nil)
Creates and opens new documents.
- Parameters:
- label: A label to use for the button.
- contentType: An optional content type of the document to create.
init · iOS 18.0+init
TypeScriptstatic initContentType91733(title: SDKHandle, contentType?: (_UniformTypeIdentifiers_UTType) | null): NewDocumentButton<_SwiftUICore_Text>
Swift declarationnonisolated init(_ title: some StringProtocol, contentType: UTType? = nil)
Creates and opens new documents.
- Parameters:
- title: A title to use as the button title.
- contentType: An optional content type of the document to create.
get · iOS 27.0+collectionID
TypeScriptget collectionID(): unknown
Swift declarationvar collectionID: CollectionID
The collection that contains the destination's position.
set · iOS 27.0+collectionID
TypeScriptset collectionID(value: unknown)
Swift declarationvar collectionID: CollectionID
The collection that contains the destination's position.
init · iOS 27.0+init
TypeScriptstatic initPositionCollectionID(position: ReorderDifference_Destination_Position<unknown, unknown>, collectionID: unknown): ReorderDifference_Destination<unknown, unknown>
Swift declarationinit(position: ReorderDifference<ItemID, CollectionID>.Destination.Position, collectionID: CollectionID)
Initializes the destination value with the provided position and
collectionID.
- Parameters:
- position: The position within the collection.
- destination: The identifier that represents this collection.
get · iOS 27.0+position
TypeScriptget position(): ReorderDifference_Destination_Position<unknown, unknown>
Swift declarationvar position: ReorderDifference<ItemID, CollectionID>.Destination.Position
The identifier position in the collection where the sources should
be moved to.
set · iOS 27.0+position
TypeScriptset position(value: ReorderDifference_Destination_Position<unknown, unknown>)
Swift declarationvar position: ReorderDifference<ItemID, CollectionID>.Destination.Position
The identifier position in the collection where the sources should
be moved to.
init · iOS 27.0+init
TypeScriptstatic initPosition(position: ReorderDifference_Destination_Position<unknown, ReorderableSingleCollectionIdentifier>): ReorderDifference_Destination<unknown, ReorderableSingleCollectionIdentifier>
Swift declarationinit(position: ReorderDifference<ItemID, CollectionID>.Destination.Position) where CollectionID == ReorderableSingleCollectionIdentifier
Initializes the destination value with the provided position and
an instance of `ReorderableSingleCollectionIdentifier`.
- Parameters:
- position: The position within the collection.
get · iOS 27.0+destination
TypeScriptget destination(): ReorderDifference_Destination<unknown, unknown>
Swift declarationvar destination: ReorderDifference<ItemID, CollectionID>.Destination
The end position of items to move during a reordering operation.
set · iOS 27.0+destination
TypeScriptset destination(value: ReorderDifference_Destination<unknown, unknown>)
Swift declarationvar destination: ReorderDifference<ItemID, CollectionID>.Destination
The end position of items to move during a reordering operation.
get · iOS 27.0+sources
TypeScriptget sources(): Array<unknown>
Swift declarationvar sources: [ItemID]
The identifiers of items to move during a reordering operation.
set · iOS 27.0+sources
TypeScriptset sources(value: Array<unknown>)
Swift declarationvar sources: [ItemID]
The identifiers of items to move during a reordering operation.
init · iOS 14.0+init
TypeScriptinit(uiAccessibilityContrast: _UIKit_UIAccessibilityContrast): (_SwiftUICore_ColorSchemeContrast) | null
Swift declarationinit?(_ uiAccessibilityContrast: UIAccessibilityContrast)
Creates a contrast from its accessibility contrast equivalent.
init · iOS 14.0+init
TypeScriptinit(uiSizeCategory: _UIKit_UIContentSizeCategory): (_SwiftUICore_ContentSizeCategory) | null
Swift declarationinit?(_ uiSizeCategory: UIContentSizeCategory)
Create a size category from its UIContentSizeCategory equivalent.
get · iOS 13.0+keyCommands
TypeScriptget keyCommands(): Promise<(Array<_UIKit_UIKeyCommand>) | null>
Swift declaration@MainActor @preconcurrency override dynamic var keyCommands: [UIKeyCommand]? { get }
get · iOS 13.0+undoManager
TypeScriptget undoManager(): Promise<(_Foundation_UndoManager) | null>
Swift declaration@MainActor @preconcurrency override dynamic var undoManager: UndoManager? { get }
method · iOS 13.0+sizeThatFits
TypeScriptsizeThatFits(size: { width: number; height: number }): Promise<{ width: number; height: number }>
Swift declaration@MainActor @preconcurrency func sizeThatFits(in size: CGSize) -> CGSize
Calculates and returns the most appropriate size for the current view.
- Parameter size: The proposed new size for the view.
- Returns: The size that offers the best fit for the root view and its
contents.
get · iOS 16.0+sizingOptions
TypeScriptget sizingOptions(): Promise<UIHostingControllerSizingOptions>
Swift declaration@MainActor @preconcurrency var sizingOptions: UIHostingControllerSizingOptions { get set }
The options for how the hosting controller tracks changes to the size
of its SwiftUI content.
The default value is the empty set.
set · iOS 16.0+sizingOptions
TypeScriptsetSizingOptions(value: UIHostingControllerSizingOptions): Promise<void>
Swift declaration@MainActor @preconcurrency var sizingOptions: UIHostingControllerSizingOptions { get set }
The options for how the hosting controller tracks changes to the size
of its SwiftUI content.
The default value is the empty set.
method · iOS 13.0+viewDidAppear
TypeScriptviewDidAppear(animated: boolean): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewDidAppear(_ animated: Bool)
Notifies the view controller that its view has been added to a
view hierarchy.
SwiftUI calls this method after adding the hosting controller's root
view to the view hierarchy. You can override this method to perform
custom tasks associated with the appearance of the view. If you
override this method, you must call `super` at some point in your
implementation.
- Parameter animated: If `true`, the view is being added
using an animation.
method · iOS 13.0+viewWillAppear
TypeScriptviewWillAppear(animated: boolean): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewWillAppear(_ animated: Bool)
Notifies the view controller that its view is about to be added to a
view hierarchy.
SwiftUI calls this method before adding the hosting controller's root
view to the view hierarchy. You can override this method to perform
custom tasks associated with the appearance of the view. If you
override this method, you must call `super` at some point in your
implementation.
- Parameter animated: If `true`, the view is being added
using an animation.
get · iOS 16.4+safeAreaRegions
TypeScriptget safeAreaRegions(): Promise<_SwiftUICore_SafeAreaRegions>
Swift declaration@MainActor @preconcurrency var safeAreaRegions: SafeAreaRegions { get set }
The safe area regions that this view controller adds to its view.
An example of when this is appropriate to use is when hosting content
that you know should never be affected by the safe area, such as a
custom scrollable container. Disabling a safe area region omits it from
the SwiftUI layout system altogether.
The default value is ``SafeAreaRegions.all``.
set · iOS 16.4+safeAreaRegions
TypeScriptsetSafeAreaRegions(value: _SwiftUICore_SafeAreaRegions): Promise<void>
Swift declaration@MainActor @preconcurrency var safeAreaRegions: SafeAreaRegions { get set }
The safe area regions that this view controller adds to its view.
An example of when this is appropriate to use is when hosting content
that you know should never be affected by the safe area, such as a
custom scrollable container. Disabling a safe area region omits it from
the SwiftUI layout system altogether.
The default value is ``SafeAreaRegions.all``.
method · iOS 13.0+viewDidDisappear
TypeScriptviewDidDisappear(animated: boolean): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewDidDisappear(_ animated: Bool)
method · iOS 13.0+viewWillDisappear
TypeScriptviewWillDisappear(animated: boolean): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewWillDisappear(_ animated: Bool)
Notifies the view controller that its view will be removed from a
view hierarchy.
SwiftUI calls this method before removing the hosting controller's root
view from the view hierarchy. You can override this method to perform
custom tasks associated with the disappearance of the view. If you
override this method, you must call `super` at some point in your
implementation.
- Parameter animated: If `true`, the view is being removed
using an animation.
method · iOS 13.0+viewWillTransition
TypeScriptviewWillTransition(size: { width: number; height: number }, coordinator: SDKHandle): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator)
get · iOS 13.0+isModalInPresentation
TypeScriptget isModalInPresentation(): Promise<boolean>
Swift declaration@MainActor @preconcurrency override dynamic var isModalInPresentation: Bool { get set }
set · iOS 13.0+isModalInPresentation
TypeScriptsetIsModalInPresentation(value: boolean): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic var isModalInPresentation: Bool { get set }
get · iOS 13.0+childForStatusBarStyle
TypeScriptget childForStatusBarStyle(): Promise<(_UIKit_UIViewController) | null>
Swift declaration@MainActor @preconcurrency override dynamic var childForStatusBarStyle: UIViewController? { get }
get · iOS 13.0+prefersStatusBarHidden
TypeScriptget prefersStatusBarHidden(): Promise<boolean>
Swift declaration@MainActor @preconcurrency override dynamic var prefersStatusBarHidden: Bool { get }
A Boolean value that indicates whether the view controller prefers the
status bar to be hidden or shown.
method · iOS 13.0+viewWillLayoutSubviews
TypeScriptviewWillLayoutSubviews(): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func viewWillLayoutSubviews()
get · iOS 13.0+childForStatusBarHidden
TypeScriptget childForStatusBarHidden(): Promise<(_UIKit_UIViewController) | null>
Swift declaration@MainActor @preconcurrency override dynamic var childForStatusBarHidden: UIViewController? { get }
get · iOS 13.0+preferredStatusBarStyle
TypeScriptget preferredStatusBarStyle(): Promise<_UIKit_UIStatusBarStyle>
Swift declaration@MainActor @preconcurrency override dynamic var preferredStatusBarStyle: UIStatusBarStyle { get }
The preferred status bar style for the view controller.
method · iOS 13.0+preferredContentSizeDidChange
TypeScriptpreferredContentSizeDidChange(container: SDKHandle): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func preferredContentSizeDidChange(forChildContentContainer container: any UIContentContainer)
get · iOS 13.0+prefersHomeIndicatorAutoHidden
TypeScriptget prefersHomeIndicatorAutoHidden(): Promise<boolean>
Swift declaration@MainActor @preconcurrency override dynamic var prefersHomeIndicatorAutoHidden: Bool { get }
A Boolean value that indicates whether the view controller prefers the
home indicator to be hidden or shown.
get · iOS 13.0+childForHomeIndicatorAutoHidden
TypeScriptget childForHomeIndicatorAutoHidden(): Promise<(_UIKit_UIViewController) | null>
Swift declaration@MainActor @preconcurrency override dynamic var childForHomeIndicatorAutoHidden: UIViewController? { get }
get · iOS 13.0+preferredStatusBarUpdateAnimation
TypeScriptget preferredStatusBarUpdateAnimation(): Promise<_UIKit_UIStatusBarAnimation>
Swift declaration@MainActor @preconcurrency override dynamic var preferredStatusBarUpdateAnimation: UIStatusBarAnimation { get }
The animation style to use when hiding or showing the status bar for
this view controller.
get · iOS 13.0+childForScreenEdgesDeferringSystemGestures
TypeScriptget childForScreenEdgesDeferringSystemGestures(): Promise<(_UIKit_UIViewController) | null>
Swift declaration@MainActor @preconcurrency override dynamic var childForScreenEdgesDeferringSystemGestures: UIViewController? { get }
get · iOS 13.0+preferredScreenEdgesDeferringSystemGestures
TypeScriptget preferredScreenEdgesDeferringSystemGestures(): Promise<SDKHandle>
Swift declaration@MainActor @preconcurrency override dynamic var preferredScreenEdgesDeferringSystemGestures: UIRectEdge { get }
Sets the screen edge from which you want your gesture to take
precedence over the system gesture.
init · iOS 13.0+init
TypeScriptstatic initCoderRootView(aDecoder: _Foundation_NSCoder, rootView: SDKHandle): Promise<(UIHostingController<SDKHandle>) | null>
Swift declaration@MainActor @preconcurrency init?(coder aDecoder: NSCoder, rootView: Content)
Creates a hosting controller object from an archive and the specified
SwiftUI view.
- Parameters:
- aDecoder: The decoder to use during initialization.
- rootView: The root view of the SwiftUI view hierarchy that you want
to manage using this view controller.
- Returns: A `UIViewController` object that you can present from your
interface.
init · iOS 13.0+init
TypeScriptstatic initCoder(aDecoder: _Foundation_NSCoder): Promise<(UIHostingController<SDKHandle>) | null>
Swift declaration@MainActor @preconcurrency required dynamic init?(coder aDecoder: NSCoder)
Creates a hosting controller object from the contents of the specified
archive.
The default implementation of this method throws an exception. To create
your view controller from an archive, override this method and
initialize the superclass using the ``init(coder:rootView:)`` method
instead.
-Parameter coder: The decoder to use during initialization.
method · iOS 13.0+didMove
TypeScriptdidMove(parent?: (_UIKit_UIViewController) | null): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func didMove(toParent parent: UIViewController?)
method · iOS 13.0+loadView
TypeScriptloadView(): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func loadView()
init · iOS 13.0+init
TypeScriptstatic initRootView(rootView: SDKHandle): Promise<UIHostingController<SDKHandle>>
Swift declaration@MainActor @preconcurrency init(rootView: Content)
Creates a hosting controller object that wraps the specified SwiftUI
view.
- Parameter rootView: The root view of the SwiftUI view hierarchy that
you want to manage using the hosting view controller.
- Returns: A `UIHostingController` object initialized with the
specified SwiftUI view.
get · iOS 13.0+rootView
TypeScriptget rootView(): Promise<SDKHandle>
Swift declaration@MainActor @preconcurrency var rootView: Content { get set }
The root view of the SwiftUI view hierarchy managed by this view
controller.
set · iOS 13.0+rootView
TypeScriptsetRootView(value: SDKHandle): Promise<void>
Swift declaration@MainActor @preconcurrency var rootView: Content { get set }
The root view of the SwiftUI view hierarchy managed by this view
controller.
method · iOS 13.0+willMove
TypeScriptwillMove(parent?: (_UIKit_UIViewController) | null): Promise<void>
Swift declaration@MainActor @preconcurrency override dynamic func willMove(toParent parent: UIViewController?)
get · iOS 18.0+actions
TypeScriptget actions(): SectionConfiguration_Actions
Swift declarationvar actions: SectionConfiguration.Actions { get }
Custom actions associated with a section.
This property provides programmatic access to the actions defined on a
``Section``. If no actions were specified, the collection will be empty.
The following `MailboxView` will put actions into an overflow menu if
there are too many to display inline.
struct MailboxView<Content: View>: View {
var content: Content
init(@ContentBuilder content: () -> Content) {
self.content = content()
}
var body: some View {
ForEach(sections: content) { section in
HStack {
section.header
Spacer()
Group(subviews: section.actions) { actions in
if actions.count > 2 {
actions[0]
// Place the extras in an overflow menu.
Menu("Actions", systemImage: "plus") {
actions[1...]
}
} else {
actions
}
}
}
section.content
}
}
}
You can then use actions in `MailboxView` without considering overflow.
MailboxView {
Section("iCloud") {
Label("Receipts", systemImage: "folder")
Label("Mailing Lists", systemImage: "folder")
}
.sectionActions {
Button("New", systemImage: "folder.badge.plus") {}
Button("Edit", systemImage: "folder.badge.gearshape") {}
Button("Delete", systemImage: "folder.badge.minus") {}
}
}
get · iOS 16.0+value
TypeScriptget value(): unknown
Swift declarationvar value: T
set · iOS 16.0+value
TypeScriptset value(value: unknown)
Swift declarationvar value: T
get · iOS 15.0+sortDescriptors
TypeScriptget sortDescriptors(): Promise<Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>>
Swift declarationvar sortDescriptors: [SortDescriptor<Result>] { get set }
The request's sort descriptors, accessed as value types.
Set this configuration value to cause a ``SectionedFetchRequest`` to
execute a fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``SectionedFetchRequest/Configuration/nsSortDescriptors``
instead. Use care to coordinate section and sort updates, as described
in ``SectionedFetchRequest/Configuration``.
Access this value for a given request by using the
``SectionedFetchResults/sortDescriptors`` property on the associated
``SectionedFetchResults`` instance, either directly or with a
``Binding``.
set · iOS 15.0+sortDescriptors
TypeScriptsetSortDescriptors(value: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>): Promise<void>
Swift declarationvar sortDescriptors: [SortDescriptor<Result>] { get set }
The request's sort descriptors, accessed as value types.
Set this configuration value to cause a ``SectionedFetchRequest`` to
execute a fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``SectionedFetchRequest/Configuration/nsSortDescriptors``
instead. Use care to coordinate section and sort updates, as described
in ``SectionedFetchRequest/Configuration``.
Access this value for a given request by using the
``SectionedFetchResults/sortDescriptors`` property on the associated
``SectionedFetchResults`` instance, either directly or with a
``Binding``.
init · iOS 15.0+init
TypeScriptstatic initSectionIdentifierSortDescriptorsPredicateAnimation(sectionIdentifier: "faultingState" | SDKHandle, sortDescriptors: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>, predicate?: (_Foundation_NSPredicate) | null, animation?: (_SwiftUICore_Animation) | null): Promise<SectionedFetchRequest<number, _CoreData_NSManagedObject>>
Swift declaration@MainActor @preconcurrency init(sectionIdentifier: KeyPath<Result, SectionIdentifier>, sortDescriptors: [SortDescriptor<Result>], predicate: NSPredicate? = nil, animation: Animation? = nil)
Creates a sectioned fetch request based on a section identifier,
a predicate, and value type sort parameters.
The request gets the entity type from the `Result` instance by calling
that managed object's
<doc://com.apple.documentation/documentation/CoreData/NSManagedObject/entity()>
type method. If you need to specify the entity type explicitly, use the
``init(entity:sectionIdentifier:sortDescriptors:predicate:animation:)``
initializer instead. If you need more control over the fetch request
configuration, use ``init(fetchRequest:sectionIdentifier:animation:)``.
For reference type sort descriptors, use
``init(sectionIdentifier:sortDescriptors:predicate:animation:)``.
- Parameters:
- sectionIdentifier: A key path that SwiftUI applies to the `Result`
type to get an object's section identifier.
- sortDescriptors: An array of sort descriptors that define the sort
order of the fetched results.
- predicate: An
<doc://com.apple.documentation/documentation/Foundation/NSPredicate>
instance that defines logical conditions used to filter the fetched
results.
- animation: The animation to use for user interface changes that
result from changes to the fetched results.
init · iOS 15.0+init
TypeScriptstatic initSectionIdentifierSortDescriptorsPredicateAnimation94113(sectionIdentifier: "faultingState" | SDKHandle, sortDescriptors: Array<_Foundation_NSSortDescriptor>, predicate?: (_Foundation_NSPredicate) | null, animation?: (_SwiftUICore_Animation) | null): Promise<SectionedFetchRequest<number, _CoreData_NSManagedObject>>
Swift declaration@MainActor @preconcurrency init(sectionIdentifier: KeyPath<Result, SectionIdentifier>, sortDescriptors: [NSSortDescriptor], predicate: NSPredicate? = nil, animation: Animation? = nil)
Creates a sectioned fetch request based on a section identifier, a
predicate, and reference type sort parameters.
The request gets the entity type from the `Result` instance by calling
that managed object's
<doc://com.apple.documentation/documentation/CoreData/NSManagedObject/entity()>
type method. If you need to specify the entity type explicitly, use the
``init(entity:sectionIdentifier:sortDescriptors:predicate:animation:)``
initializer instead. If you need more control over the fetch request
configuration, use ``init(fetchRequest:sectionIdentifier:animation:)``.
For value type sort descriptors, use
``init(sectionIdentifier:sortDescriptors:predicate:animation:)``.
- Parameters:
- sectionIdentifier: A key path that SwiftUI applies to the `Result`
type to get an object's section identifier.
- sortDescriptors: An array of sort descriptors that define the sort
order of the fetched results.
- predicate: An
<doc://com.apple.documentation/documentation/Foundation/NSPredicate>
instance that defines logical conditions used to filter the fetched
results.
- animation: The animation to use for user interface changes that
result from changes to the fetched results.
get · iOS 15.0+sortDescriptors
TypeScriptget sortDescriptors(): Promise<Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get nonmutating set }
The request's sort descriptors, accessed as value types.
Set this value to cause the associated ``SectionedFetchRequest`` to
execute a fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. The order of entities stored in the results collection may
change as a result. Use care to coordinate section and sort updates, as
described in ``SectionedFetchRequest/Configuration``.
If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``SectionedFetchResults/nsSortDescriptors`` instead.
set · iOS 15.0+sortDescriptors
TypeScriptsetSortDescriptors(value: Array<_Foundation_SortDescriptor<_CoreData_NSManagedObject>>): Promise<void>
Swift declaration@MainActor @preconcurrency var sortDescriptors: [SortDescriptor<Result>] { get nonmutating set }
The request's sort descriptors, accessed as value types.
Set this value to cause the associated ``SectionedFetchRequest`` to
execute a fetch with a new collection of
<doc://com.apple.documentation/documentation/Foundation/SortDescriptor>
instances. The order of entities stored in the results collection may
change as a result. Use care to coordinate section and sort updates, as
described in ``SectionedFetchRequest/Configuration``.
If you want to use
<doc://com.apple.documentation/documentation/Foundation/NSSortDescriptor>
instances, set ``SectionedFetchResults/nsSortDescriptors`` instead.
static · iOS 17.0+search
TypeScriptstatic searchText(text: string): ContentUnavailableView<SearchUnavailableContent_Label, SearchUnavailableContent_Description, SearchUnavailableContent_Actions>
Swift declarationstatic func search(text: String) -> ContentUnavailableView<Label, Description, Actions>
Creates a `ContentUnavailableView` instance that conveys a search state.
For example, consider the usage of this static member in *ContactsListView*:
struct ContactsListView: View {
@ObservedObject private var viewModel = ContactsViewModel()
var body: some View {
NavigationStack {
CustomSearchBar(query: $viewModel.searchText)
List {
ForEach(viewModel.searchResults) { contact in
NavigationLink {
ContactsView(contact)
} label: {
Text(contact.name)
}
}
}
.navigationTitle("Contacts")
.overlay {
if viewModel.searchResults.isEmpty {
ContentUnavailableView
.search(text: viewModel.searchText)
}
}
}
}
}
- Parameter text: The search text query.
get · iOS 17.0+search
TypeScriptstatic get search(): ContentUnavailableView<SearchUnavailableContent_Label, SearchUnavailableContent_Description, SearchUnavailableContent_Actions>
Swift declarationstatic var search: ContentUnavailableView<SearchUnavailableContent.Label, SearchUnavailableContent.Description, SearchUnavailableContent.Actions> { get }
Creates a `ContentUnavailableView` instance that conveys a search state.
A `ContentUnavailableView` initialized with this static member is expected to
be contained within a searchable view hierarchy. Such a configuration
enables the search query to be parsed into the view's description.
For example, consider the usage of this static member in *ContactsListView*:
struct ContactsListView: View {
@ObservedObject private var viewModel = ContactsViewModel()
var body: some View {
NavigationStack {
List {
ForEach(viewModel.searchResults) { contact in
NavigationLink {
ContactsView(contact)
} label: {
Text(contact.name)
}
}
}
.navigationTitle("Contacts")
.searchable(text: $viewModel.searchText)
.overlay {
if searchResults.isEmpty {
ContentUnavailableView.search
}
}
}
}
}
get · iOS 26.0+body
TypeScriptget body(): Array<SliderTick<number>>
Swift declarationvar body: [SliderTick<V>] { get }
The value of this type's content.
get · iOS 26.0+value
TypeScriptget value(): unknown
Swift declarationvar value: T
set · iOS 26.0+value
TypeScriptset value(value: unknown)
Swift declarationvar value: T
method · iOS 16.0+background
TypeScriptbackground(style: SDKHandle): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declarationfunc background<S>(_ style: S) -> UIHostingConfiguration<Content, _UIHostingConfigurationBackgroundView<S>> where S : ShapeStyle
Sets the background contents for the hosting configuration's enclosing
cell.
The following example sets a custom view to the background of the cell:
UIHostingConfiguration {
Text("My Contents")
}
.background(Color.blue)
- Parameter style: The shape style to be used as the background of the
cell.
method · iOS 16.0+makeContentView
TypeScriptmakeContentView(): Promise<(_UIKit_UIView) & (SDKHandle)>
Swift declaration@MainActor func makeContentView() -> any UIView & UIContentView
method · iOS 16.0+margins
TypeScriptmargins(edges: _SwiftUICore_Edge_Set, length: number): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declarationfunc margins(_ edges: Edge.Set = .all, _ length: CGFloat) -> UIHostingConfiguration<Content, Background>
Sets the margins around the content of the configuration.
Use this modifier to replace the default margins applied to the root of
the configuration. The following example creates 20 points of space
between the content and the background on the horizontal edges.
UIHostingConfiguration {
Text("My Contents")
}
.margins(.horizontal, 20.0)
- Parameters:
- edges: The edges to apply the insets. Any edges not specified will
use the system default values. The default value is
``Edge/Set/all``.
- length: The amount to apply.
method · iOS 16.0+margins
TypeScriptmargins14625(edges: _SwiftUICore_Edge_Set, insets: _SwiftUICore_EdgeInsets): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declarationfunc margins(_ edges: Edge.Set = .all, _ insets: EdgeInsets) -> UIHostingConfiguration<Content, Background>
Sets the margins around the content of the configuration.
Use this modifier to replace the default margins applied to the root of
the configuration. The following example creates 10 points of space
between the content and the background on the leading edge and 20 points
of space on the trailing edge:
UIHostingConfiguration {
Text("My Contents")
}
.margins(.horizontal, 20.0)
- Parameters:
- edges: The edges to apply the insets. Any edges not specified will
use the system default values. The default value is
``Edge/Set/all``.
- insets: The insets to apply.
method · iOS 16.0+minSize
TypeScriptminSizeWidthHeight(width?: (number) | null, height?: (number) | null): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declarationfunc minSize(width: CGFloat? = nil, height: CGFloat? = nil) -> UIHostingConfiguration<Content, Background>
Sets the minimum size for the configuration.
Use this modifier to indicate that a configuration's associated cell can
be resized to a specific minimum. The following example allows the cell
to be compressed to zero size:
UIHostingConfiguration {
Text("My Contents")
}
.minSize(width: 0, height: 0)
- Parameter width: The value to use for the width dimension. A value of
`nil` indicates that the system default should be used.
- Parameter height: The value to use for the height dimension. A value
of `nil` indicates that the system default should be used.
method · iOS 16.0+minSize
TypeScriptminSize(): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declaration@export(implementation) func minSize() -> UIHostingConfiguration<Content, Background>
Sets the minimum size for the configuration.
Use the version with parameters instead.
method · iOS 16.0+updated
TypeScriptupdated(state: SDKHandle): UIHostingConfiguration<SDKHandle, SDKHandle>
Swift declarationfunc updated(for state: any UIConfigurationState) -> UIHostingConfiguration<Content, Background>
init · iOS 14.0+init
TypeScriptinit(uiUserInterfaceSizeClass: _UIKit_UIUserInterfaceSizeClass): (_SwiftUICore_UserInterfaceSizeClass) | null
Swift declarationinit?(_ uiUserInterfaceSizeClass: UIUserInterfaceSizeClass)
Creates a SwiftUI size class from the specified UIKit size class.
get · iOS 15.0+wrappedValue
TypeScriptget wrappedValue(): number
Swift declarationvar wrappedValue: Value { get nonmutating set }
The current state value, taking into account whatever bindings might be
in effect due to the current location of focus.
When focus is not in any view that is bound to this state, the wrapped
value will be `nil` (for optional-typed state) or `false` (for `Bool`-
typed state).
set · iOS 15.0+wrappedValue
TypeScriptset wrappedValue(value: number)
Swift declarationvar wrappedValue: Value { get nonmutating set }
The current state value, taking into account whatever bindings might be
in effect due to the current location of focus.
When focus is not in any view that is bound to this state, the wrapped
value will be `nil` (for optional-typed state) or `false` (for `Bool`-
typed state).
get · iOS 15.0+projectedValue
TypeScriptget projectedValue(): AccessibilityFocusState_Binding<number>
Swift declarationvar projectedValue: AccessibilityFocusState<Value>.Binding { get }
A projection of the state value that can be used to establish bindings between view content
and accessibility focus placement.
Use `projectedValue` in conjunction with
``SwiftUI/View/accessibilityFocused(_:equals:)`` to establish
bindings between view content and accessibility focus placement.
init · iOS 15.0+init
TypeScriptstatic initFor(technologies: _SwiftUICore_AccessibilityTechnologies): AccessibilityFocusState<boolean>
Swift declarationinit(for technologies: AccessibilityTechnologies) where Value == Bool
Creates a new accessibility focus state for a Boolean value, using the accessibility
technologies you specify.
- Parameters:
- technologies: One of the available ``AccessibilityTechnologies``.
init · iOS 15.0+init
TypeScriptstatic initFor83063(technologies: _SwiftUICore_AccessibilityTechnologies): AccessibilityFocusState<(number) | null>
Swift declarationinit<T>(for technologies: AccessibilityTechnologies) where Value == T?, T : Hashable
Creates a new accessibility focus state of the type and
using the accessibility technologies you specify.
- Parameter technologies: One or more of the available
``AccessibilityTechnologies``.
get · iOS 15.0+wrappedValue
TypeScriptget wrappedValue(): number
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the bound property.
set · iOS 15.0+wrappedValue
TypeScriptset wrappedValue(value: number)
Swift declarationvar wrappedValue: Value { get nonmutating set }
The underlying value referenced by the bound property.
get · iOS 15.0+projectedValue
TypeScriptget projectedValue(): AccessibilityFocusState_Binding<number>
Swift declarationvar projectedValue: AccessibilityFocusState<Value>.Binding { get }
The currently focused element.
init · iOS 15.0+init
TypeScriptstatic init(): AccessibilityFocusState<boolean>
Swift declarationinit() where Value == Bool
Creates a new accessibility focus state for a Boolean value.
init · iOS 15.0+init
TypeScriptstatic init72086(): AccessibilityFocusState<(number) | null>
Swift declarationinit<T>() where Value == T?, T : Hashable
Creates a new accessibility focus state of the type you provide.
get · iOS 15.0+body
TypeScriptget body(): Promise<never>
Swift declaration@MainActor @preconcurrency var body: Never { get }
The internal content of this `AccessibilityRotorContent`.
init · iOS 16.0+init
TypeScriptstatic initIdInTextRangePrepare(label: _Foundation_LocalizedStringResource, id: number, namespace: _SwiftUICore_Namespace_ID, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declaration@export(implementation) init(_ label: LocalizedStringResource, id: ID, in namespace: Namespace.ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label, identifier and namespace,
and with an optional range.
- Parameters:
- label: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier and namespace should match a call to
`accessibilityRotorEntry(id:in)`.
- namespace: Namespace for this identifier. Should match a call
to `accessibilityRotorEntry(id:in)`.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This should be used to
bring the Accessibility element on-screen, if scrolling is needed to
get to it.
init · iOS 15.0+init
TypeScriptstatic initIdInTextRangePrepare42212(labelKey: _SwiftUICore_LocalizedStringKey, id: number, namespace: _SwiftUICore_Namespace_ID, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit(_ labelKey: LocalizedStringKey, id: ID, in namespace: Namespace.ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label, identifier and namespace,
and with an optional range.
- Parameters:
- labelKey: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier and namespace should match a call to
`accessibilityRotorEntry(id:in)`.
- namespace: Namespace for this identifier. Should match a call
to `accessibilityRotorEntry(id:in)`.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This should be used to
bring the Accessibility element on-screen, if scrolling is needed to
get to it.
init · iOS 15.0+init
TypeScriptstatic initIdInTextRangePrepare27547(label: _SwiftUICore_Text, id: number, namespace: _SwiftUICore_Namespace_ID, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit(_ label: Text, id: ID, in namespace: Namespace.ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label, identifier and namespace,
and with an optional range.
- Parameters:
- label: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier and namespace should match a call to
`accessibilityRotorEntry(id:in)`.
- namespace: Namespace for this identifier. Should match a call
to `accessibilityRotorEntry(id:in)`.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This should be used to
bring the Accessibility element on-screen, if scrolling is needed to
get to it.
init · iOS 16.0+init
TypeScriptstatic initIdTextRangePrepare(label: _Foundation_LocalizedStringResource, id: number, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declaration@export(implementation) init(_ label: LocalizedStringResource, id: ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label and identifier, with an
optional range.
- Parameters:
- id: Used to find the UI element associated with this
Rotor entry. This identifier should be used within a `scrollView`,
either in a `ForEach` or using an `id` call.
- label: Localized string used to show this Rotor entry
to users.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element on-screen if it isn't already, and SwiftUI
is not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initIdTextRangePrepare57174(labelKey: _SwiftUICore_LocalizedStringKey, id: number, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit(_ labelKey: LocalizedStringKey, id: ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label and identifier, with an
optional range.
- Parameters:
- labelKey: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier should be used within a `scrollView`,
either in a `ForEach` or using an `id` call.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element on-screen if it isn't already, and SwiftUI
is not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initIdTextRangePrepare84633(label: _SwiftUICore_Text, id: number, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit(_ label: Text, id: ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label and identifier, with an
optional range.
- Parameters:
- label: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier should be used within a `scrollView`,
either in a `ForEach` or using an `id` call.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
either label or accessibility value of the associated element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element on-screen if it isn't already, and SwiftUI
is not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initIdTextRangePrepare87936(label: string, id: number, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit<L>(_ label: L, id: ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {}) where L : StringProtocol
Create a Rotor entry with a specific label and identifier, with an
optional range.
- Parameters:
- label: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier should be used within a `scrollView`,
either in a `ForEach` or using an `id` call.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element on-screen if it isn't already, and SwiftUI
is not able to automatically scroll to it.
init · iOS 16.0+init
TypeScriptstatic initTextRangePrepare(label: _Foundation_LocalizedStringResource, textRange: SDKHandle, prepare?: (() => void)): AccessibilityRotorEntry<never>
Swift declaration@export(implementation) init(_ label: LocalizedStringResource, textRange: Range<String.Index>, prepare: @escaping () -> Void = {}) where ID == Never
Create a Rotor entry with a specific label and range. This Rotor entry
will be associated with the Accessibility element that owns the Rotor.
- Parameters:
- label: Localized string used to show this Rotor entry
to users. If no label is specified, the Rotor entry will be labeled
based on the text at that range.
- textRange: Range of text associated with this Rotor
entry.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element or text on-screen if it isn't already,
and SwiftUI not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initTextRangePrepare24341(label: (_SwiftUICore_Text) | null, textRange: SDKHandle, prepare?: (() => void)): AccessibilityRotorEntry<never>
Swift declarationinit(_ label: Text? = nil, textRange: Range<String.Index>, prepare: @escaping () -> Void = {}) where ID == Never
Create a Rotor entry with a specific label and range. This Rotor entry
will be associated with the Accessibility element that owns the Rotor.
- Parameters:
- label: Optional localized string used to show this Rotor entry
to users. If no label is specified, the Rotor entry will be labeled
based on the text at that range.
- textRange: Range of text associated with this Rotor
entry.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element or text on-screen if it isn't already,
and SwiftUI not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initTextRangePrepare24101(label: string, textRange: SDKHandle, prepare?: (() => void)): AccessibilityRotorEntry<never>
Swift declarationinit<L>(_ label: L, textRange: Range<String.Index>, prepare: @escaping () -> Void = {}) where ID == Never, L : StringProtocol
Create a Rotor entry with a specific label and range. This Rotor entry
will be associated with the Accessibility element that owns the Rotor.
- Parameters:
- label: Localized string used to show this Rotor entry
to users. If no label is specified, the Rotor entry will be labeled
based on the text at that range.
- textRange: Range of text associated with this Rotor
entry.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element or text on-screen if it isn't already,
and SwiftUI not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initTextRangePrepare56839(labelKey: _SwiftUICore_LocalizedStringKey, textRange: SDKHandle, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit(_ labelKey: LocalizedStringKey, textRange: Range<String.Index>, prepare: @escaping () -> Void = {})
Create a Rotor entry with a specific label and range. This Rotor entry
will be associated with the Accessibility element that owns the Rotor.
- Parameters:
- labelKey: Localized string used to show this Rotor entry
to users. If no label is specified, the Rotor entry will be labeled
based on the text at that range.
- textRange: Range of text associated with this Rotor
entry.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This can be used to
bring the UI element or text on-screen if it isn't already,
and SwiftUI not able to automatically scroll to it.
init · iOS 15.0+init
TypeScriptstatic initInTextRangePrepare(label: string, id: number, namespace: _SwiftUICore_Namespace_ID, textRange?: (SDKHandle) | null, prepare?: (() => void)): AccessibilityRotorEntry<number>
Swift declarationinit<L>(_ label: L, _ id: ID, in namespace: Namespace.ID, textRange: Range<String.Index>? = nil, prepare: @escaping () -> Void = {}) where L : StringProtocol
Create a Rotor entry with a specific label, identifier and namespace,
and with an optional range.
- Parameters:
- label: Localized string used to show this Rotor entry
to users.
- id: Used to find the UI element associated with this
Rotor entry. This identifier and namespace should match a call to
`accessibilityRotorEntry(id:in)`.
- namespace: Namespace for this identifier. Should match a call
to `accessibilityRotorEntry(id:in)`.
- textRange: Optional range of text associated with this Rotor
entry. This should be a range within text that is set as the
accessibility label or accessibility value of the associated
element.
- prepare: Optional closure to run before a Rotor entry
is navigated to, to prepare the UI as needed. This should be used to
bring the Accessibility element on-screen, if scrolling is needed to
get to it.
get · iOS 16.0+value
TypeScriptget value(): unknown
Swift declarationvar value: T
The value of a row presented by this column content.
set · iOS 16.0+value
TypeScriptset value(value: unknown)
Swift declarationvar value: T
The value of a row presented by this column content.
get · iOS 26.0+body
TypeScriptget body(): Array<SliderTick<SDKHandle>>
Swift declarationvar body: [SliderTick<SliderTickContentForEach<Data, ID, Content>.Value>] { get }
The value of this type's content.
method · iOS 17.0+resetOrder
TypeScriptresetOrder(): void
Swift declarationmutating func resetOrder()
Resets the column order back to the default, preserving the customized
visibility and size.
Tables that are bound to this state will order their columns as
described by their column builder.
subscript · iOS 17.0+subscript
TypeScriptsubscript(id: string): _SwiftUICore_Visibility
Swift declarationsubscript(visibility id: String) -> Visibility { get set }
The visibility of the column identified by its identifier.
Explicit identifiers can be associated with a `TableColumn` using the
`customizationID(_:)` modifier.
TableColumn("Number of Reports", value: \.duplicateCount) {
Text($0.duplicateCount, format: .number)
}
.customizationID("numberOfReports")
...
columnsCustomization[visibility: "numberOfReports"] = .hidden
If the ID isn't associated with the state, a default value of
`.automatic` is returned.
get · iOS 14.0+ · Deprecated in iOS 100000.0isEditable
TypeScriptget isEditable(): boolean
Swift declarationvar isEditable: Bool
A Boolean that indicates whether you can edit the document.
This value is `false` if the document is in viewing mode, or if the
file is not writable.
set · iOS 14.0+ · Deprecated in iOS 100000.0isEditable
TypeScriptset isEditable(value: boolean)
Swift declarationvar isEditable: Bool
A Boolean that indicates whether you can edit the document.
This value is `false` if the document is in viewing mode, or if the
file is not writable.
get · iOS 27.0+ · Deprecated in iOS 100000.0creationSource
TypeScriptget creationSource(): (DocumentCreationSource) | null
Swift declarationvar creationSource: DocumentCreationSource? { get }
The source associated with the button that created this document.
On iOS, you can specify the source via a ``NewDocumentButton`` in
``DocumentGroupLaunchScene``:
extension DocumentCreationSource {
static let scanner: Self =
DocumentCreationSource(id: "document-from-scanner")
static let template: Self =
DocumentCreationSource(id: "document-from-template")
}
DocumentGroupLaunchScene("Documents") {
NewDocumentButton("Scan Document", source: .scanner)
NewDocumentButton("New from Template", source: .template)
}
Use this property to determine which ``NewDocumentButton`` triggered
the creation of the current document, allowing you to customize the UI
accordingly.
get · iOS 14.0+ · Deprecated in iOS 100000.0fileURL
TypeScriptget fileURL(): (string) | null
Swift declarationvar fileURL: URL?
The URL of the open file document.
set · iOS 14.0+ · Deprecated in iOS 100000.0fileURL
TypeScriptset fileURL(value: (string) | null)
Swift declarationvar fileURL: URL?
The URL of the open file document.
get · iOS 14.0+ · Deprecated in iOS 100000.0$document
TypeScriptget $document(): _SwiftUICore_Binding<SDKHandle>
Swift declarationvar $document: Binding<Document> { get }
init · iOS 27.0+init
TypeScriptstatic init(configuration: DocumentReadConfiguration, makeSnapshot: ((arg0: _Foundation_FileWrapper) => Promise<unknown>)): FileWrapperDocumentReader<unknown>
Swift declarationinit(_ configuration: sending FileWrapperDocumentReader<Snapshot>.ReadConfiguration, makeSnapshot: @escaping (FileWrapper) async throws -> sending Snapshot)
Creates a reader that converts a `FileWrapper` into a snapshot.
- Parameters:
- configuration: The read configuration passed to
``ReadableDocument/reader(configuration:)``.
- makeSnapshot: A closure that deserializes the
`FileWrapper` into a snapshot. For flat files, read
`regularFileContents`. For packages, navigate
`fileWrappers` to find children. Throw an error if the
data is malformed.
init · iOS 27.0+init
TypeScriptstatic init(configuration: DocumentWriteConfiguration, makeFileWrapper: ((arg0: unknown, arg1: (_Foundation_FileWrapper) | null) => Promise<_Foundation_FileWrapper>)): FileWrapperDocumentWriter<unknown>
Swift declarationinit(_ configuration: sending FileWrapperDocumentWriter<Snapshot>.WriteConfiguration, makeFileWrapper: @escaping (Snapshot, FileWrapper?) async throws -> FileWrapper)
Creates a writer that converts a snapshot into a `FileWrapper`.
- Parameters:
- configuration: Properties required to write a document to disk.
- makeFileWrapper: Serializes a `Snapshot` into a `FileWrapper`.
The closure takes the following parameters:
- `snapshot`: The snapshot to serialize into a `FileWrapper`.
- `previous`: The previous file wrapper that can be reused to
optimize writing. If the latest operation for the document
was writing, it is the file wrapper used for writing. If
the latest operation was reading, SwiftUI passes the file
wrapper read by a companion `FileWrapperDocumentReader`.
get · iOS 16.0+startIndex
TypeScriptget startIndex(): SDKHandle
Swift declarationvar startIndex: IndexedIdentifierCollection<Base, ID>.Index { get }
The position of the first element in a nonempty collection.
If the collection is empty, `startIndex` is equal to `endIndex`.
method · iOS 16.0+index
TypeScriptindex(i: SDKHandle): SDKHandle
Swift declarationfunc index(after i: IndexedIdentifierCollection<Base, ID>.Index) -> IndexedIdentifierCollection<Base, ID>.Index
Returns the position immediately after the given index.
The successor of an index must be well defined. For an index `i` into a
collection `c`, calling `c.index(after: i)` returns the same index every
time.
- Parameter i: A valid index of the collection. `i` must be less than
`endIndex`.
- Returns: The index value immediately after `i`.
get · iOS 16.0+endIndex
TypeScriptget endIndex(): SDKHandle
Swift declarationvar endIndex: IndexedIdentifierCollection<Base, ID>.Index { get }
The collection's "past the end" position---that is, the position one
greater than the last valid subscript argument.
When you need a range that includes the last element of a collection, use
the half-open range operator (`..<`) with `endIndex`. The `..<` operator
creates a range that doesn't include the upper bound, so it's always
safe to use with `endIndex`. For example:
let numbers = [10, 20, 30, 40, 50]
if let index = numbers.firstIndex(of: 30) {
print(numbers[index ..< numbers.endIndex])
}
// Prints "[30, 40, 50]"
If the collection is empty, `endIndex` is equal to `startIndex`.
subscript · iOS 16.0+subscript
TypeScriptsubscript(position: SDKHandle): IndexedIdentifierCollection_Element<SDKHandle, number>
Swift declarationsubscript(position: IndexedIdentifierCollection<Base, ID>.Index) -> IndexedIdentifierCollection<Base, ID>.Element { get }
Accesses the element at the specified position.
The following example accesses an element of an array through its
subscript to print its value:
var streets = ["Adams", "Bryant", "Channing", "Douglas", "Evarts"]
print(streets[1])
// Prints "Bryant"
You can subscript a collection with any valid index other than the
collection's end index. The end index refers to the position one past
the last element of a collection, so it doesn't correspond with an
element.
- Parameter position: The position of the element to access. `position`
must be a valid index of the collection that is not equal to the
`endIndex` property.
- Complexity: O(1)
get · iOS 18.0+converter
TypeScriptget converter(): UIGestureRecognizerRepresentableCoordinateSpaceConverter
Swift declarationlet converter: UIGestureRecognizerRepresentableCoordinateSpaceConverter
A structure used to convert locations to/from coordinate spaces in
the hierarchy of the associated SwiftUI view.
get · iOS 18.0+body
TypeScriptget body(): Promise<Tab<number, SDKHandle, SDKHandle>>
Swift declaration@MainActor @preconcurrency var body: Tab<Value, Content, Label> { get }
The value of this type's nested content.
init · iOS 16.0+init
TypeScriptstatic init(configuration: FormStyleConfiguration): Form<FormStyleConfiguration_Content>
Swift declarationnonisolated init(_ configuration: FormStyleConfiguration)
Creates a form based on a form style configuration.
- Parameter configuration: The properties of the form.
init · iOS 16.0+init
TypeScriptstatic initDestination(titleResource: _Foundation_LocalizedStringResource, destination: string): Promise<Link<_SwiftUICore_Text>>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, destination: URL)
Creates a control, consisting of a URL and a title resource, used to
navigate to a URL.
Use ``Link`` to create a control that your app uses to navigate to a
URL that you provide. The example below creates a link to
`example.com` and uses `Visit Example Co` as the title key to
generate a link-styled view in your app:
Link("Visit Example Co",
destination: URL(string: "https://www.example.com/")!)
- Parameters:
- titleResource: The localized title that describes the
purpose of this link.
- destination: The URL for the link.
init · iOS 14.0+init
TypeScriptstatic initDestination43721(titleKey: _SwiftUICore_LocalizedStringKey, destination: string): Promise<Link<_SwiftUICore_Text>>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, destination: URL)
Creates a control, consisting of a URL and a title key, used to
navigate to a URL.
Use ``Link`` to create a control that your app uses to navigate to a
URL that you provide. The example below creates a link to
`example.com` and uses `Visit Example Co` as the title key to
generate a link-styled view in your app:
Link("Visit Example Co",
destination: URL(string: "https://www.example.com/")!)
- Parameters:
- titleKey: The key for the localized title that describes the
purpose of this link.
- destination: The URL for the link.
init · iOS 14.0+init
TypeScriptstatic initDestination68447(title: string, destination: string): Promise<Link<_SwiftUICore_Text>>
Swift declarationnonisolated init<S>(_ title: S, destination: URL) where S : StringProtocol
Creates a control, consisting of a URL and a title string, used to
navigate to a URL.
Use ``Link`` to create a control that your app uses to navigate to a
URL that you provide. The example below creates a link to
`example.com` and displays the title string you provide as a
link-styled view in your app:
func marketingLink(_ callToAction: String) -> Link {
Link(callToAction,
destination: URL(string: "https://www.example.com/")!)
}
- Parameters:
- title: A text string used as the title for describing the
underlying `destination` URL.
- destination: The URL for the link.
init · iOS 14.0+init
TypeScriptstatic init(configuration: MenuStyleConfiguration): Menu<MenuStyleConfiguration_Label, MenuStyleConfiguration_Content>
Swift declarationnonisolated init(_ configuration: MenuStyleConfiguration)
Creates a menu based on a style configuration.
Use this initializer within the ``MenuStyle/makeBody(configuration:)``
method of a ``MenuStyle`` instance to create an instance of the menu
being styled. This is useful for custom menu styles that modify the
current menu style.
For example, the following code creates a new, custom style that adds a
red border around the current menu style:
struct RedBorderMenuStyle: MenuStyle {
func makeBody(configuration: Configuration) -> some View {
Menu(configuration)
.border(Color.red)
}
}
init · iOS 15.0+init
TypeScriptstatic init(nsUnderlineStyle: _UIKit_NSUnderlineStyle): (_SwiftUICore_Text_LineStyle) | null
Swift declarationinit?(nsUnderlineStyle: NSUnderlineStyle)
Creates a ``Text.LineStyle`` from ``NSUnderlineStyle``.
> Note: Use this initializer only if you need to convert an existing
``NSUnderlineStyle`` to a SwiftUI ``Text.LineStyle``.
Otherwise, create a ``Text.LineStyle`` using an
initializer like ``init(pattern:color:)``.
- Parameter nsUnderlineStyle: A value of ``NSUnderlineStyle``
to wrap with ``Text.LineStyle``.
- Returns: A new ``Text.LineStyle`` or `nil` when
`nsUnderlineStyle` contains styles not supported by ``Text.LineStyle``.
method · iOS 15.0+accessibilityTextContentType
TypeScriptaccessibilityTextContentType(value: _SwiftUICore_AccessibilityTextContentType): _SwiftUICore_Text
Swift declarationnonisolated func accessibilityTextContentType(_ value: AccessibilityTextContentType) -> Text
Sets an accessibility text content type.
Use this modifier to set the content type of this accessibility
element. Assistive technologies can use this property to choose
an appropriate way to output the text. For example, when
encountering a source coding context, VoiceOver could
choose to speak all punctuation.
If you don't set a value with this method, the default content type
is ``AccessibilityTextContentType/plain``.
- Parameter value: The accessibility content type from the available
``AccessibilityTextContentType`` options.
method · iOS 15.0+accessibilityLabel
TypeScriptaccessibilityLabel(label: _SwiftUICore_Text): _SwiftUICore_Text
Swift declarationnonisolated func accessibilityLabel(_ label: Text) -> Text
Adds a label to the view that describes its contents.
Use this method to provide an alternative accessibility label
to the text that is displayed. For example, you can give an alternate label to a navigation title:
var body: some View {
NavigationView {
ContentView()
.navigationTitle(Text("").accessibilityLabel("Inbox"))
}
}
You can't style the label that you add
- Parameter label: The text view to add the label to.
method · iOS 16.0+accessibilityLabel
TypeScriptaccessibilityLabel61829(label: _Foundation_LocalizedStringResource): _SwiftUICore_Text
Swift declaration@export(implementation) nonisolated func accessibilityLabel(_ label: LocalizedStringResource) -> Text
Adds a label to the view that describes its contents.
Use this method to provide an alternative accessibility label to the
text that is displayed.
For example, you can give an alternate label to a navigation title:
var body: some View {
NavigationView {
ContentView()
.navigationTitle(Text("").accessibilityLabel("Inbox"))
}
}
- Parameter label: The string resource for the alternative
accessibility label.
method · iOS 15.0+accessibilityLabel
TypeScriptaccessibilityLabel70866(label: string): _SwiftUICore_Text
Swift declarationnonisolated func accessibilityLabel<S>(_ label: S) -> Text where S : StringProtocol
Adds a label to the view that describes its contents.
Use this method to provide an alternative accessibility label to the text that is displayed.
For example, you can give an alternate label to a navigation title:
var body: some View {
NavigationView {
ContentView()
.navigationTitle(Text("").accessibilityLabel("Inbox"))
}
}
- Parameter label: The string for the alternative accessibility label.
method · iOS 15.0+accessibilityLabel
TypeScriptaccessibilityLabel60513(labelKey: _SwiftUICore_LocalizedStringKey): _SwiftUICore_Text
Swift declarationnonisolated func accessibilityLabel(_ labelKey: LocalizedStringKey) -> Text
Adds a label to the view that describes its contents.
Use this method to provide an alternative accessibility label to the text that is displayed.
For example, you can give an alternate label to a navigation title:
var body: some View {
NavigationView {
ContentView()
.navigationTitle(Text("").accessibilityLabel("Inbox"))
}
}
- Parameter labelKey: The string key for the alternative
accessibility label.
method · iOS 15.0+accessibilityHeading
TypeScriptaccessibilityHeading(level: _SwiftUICore_AccessibilityHeadingLevel): _SwiftUICore_Text
Swift declarationnonisolated func accessibilityHeading(_ level: AccessibilityHeadingLevel) -> Text
Sets the accessibility level of this heading.
Use this modifier to set the level of this heading in relation to other headings. The system speaks
the level number of levels ``AccessibilityHeadingLevel/h1`` through
``AccessibilityHeadingLevel/h6`` alongside the text.
The default heading level if you don't use this modifier
is ``AccessibilityHeadingLevel/unspecified``.
- Parameter level: The heading level to associate with this element
from the available ``AccessibilityHeadingLevel`` levels.
init · iOS 15.0+init
TypeScriptstatic initUiColor(uiColor: _UIKit_UIColor): _SwiftUICore_Color
Swift declarationinit(uiColor: UIColor)
Creates a color from a UIKit color.
Use this method to create a SwiftUI color from a
<doc://com.apple.documentation/documentation/UIKit/UIColor> instance.
The new color preserves the adaptability of the original.
For example, you can create a rectangle using
<doc://com.apple.documentation/documentation/UIKit/UIColor/link>
to see how the shade adjusts to match the user's system settings:
struct Box: View {
var body: some View {
Color(uiColor: .link)
.frame(width: 200, height: 100)
}
}
The `Box` view defined above automatically changes its
appearance when the user turns on Dark Mode. With the light and dark
appearances placed side by side, you can see the subtle difference
in shades:

> Note: Use this initializer only if you need to convert an existing
<doc://com.apple.documentation/documentation/UIKit/UIColor> to a
SwiftUI color. Otherwise, create a SwiftUI ``Color`` using an
initializer like ``init(_:red:green:blue:opacity:)``, or use a system
color like ``ShapeStyle/blue``.
- Parameter uiColor: A
<doc://com.apple.documentation/documentation/UIKit/UIColor> instance
from which to create a color.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic init(color: _UIKit_UIColor): _SwiftUICore_Color
Swift declarationinit(_ color: UIColor)
Creates a color from a UIKit color.
Use this method to create a SwiftUI color from a
<doc://com.apple.documentation/documentation/UIKit/UIColor> instance.
The new color preserves the adaptability of the original.
For example, you can create a rectangle using
<doc://com.apple.documentation/documentation/UIKit/UIColor/link>
to see how the shade adjusts to match the user's system settings:
struct Box: View {
var body: some View {
Color(UIColor.link)
.frame(width: 200, height: 100)
}
}
The `Box` view defined above automatically changes its
appearance when the user turns on Dark Mode. With the light and dark
appearances placed side by side, you can see the subtle difference
in shades:

> Note: Use this initializer only if you need to convert an existing
<doc://com.apple.documentation/documentation/UIKit/UIColor> to a
SwiftUI color. Otherwise, create a SwiftUI ``Color`` using an
initializer like ``init(_:red:green:blue:opacity:)``, or use a system
color like ``ShapeStyle/blue``.
- Parameter color: A
<doc://com.apple.documentation/documentation/UIKit/UIColor> instance
from which to create a color.
init · iOS 13.0+init
TypeScriptstatic init(uiImage: _UIKit_UIImage): _SwiftUICore_Image
Swift declarationinit(uiImage: UIImage)
Creates a SwiftUI image from a UIKit image instance.
- Parameter uiImage: The UIKit image to wrap with a SwiftUI ``Image``
instance.
init · iOS 14.0+init
TypeScriptstatic init(configuration: LabelStyleConfiguration): Label<LabelStyleConfiguration_Title, LabelStyleConfiguration_Icon>
Swift declarationnonisolated init(_ configuration: LabelStyleConfiguration)
Creates a label representing the configuration of a style.
You can use this initializer within the ``LabelStyle/makeBody(configuration:)``
method of a ``LabelStyle`` instance to create an instance of the label
that's being styled. This is useful for custom label styles that only
wish to modify the current style, as opposed to implementing a brand new
style.
For example, the following style adds a red border around the label,
but otherwise preserves the current style:
struct RedBorderedLabelStyle: LabelStyle {
func makeBody(configuration: Configuration) -> some View {
Label(configuration)
.border(Color.red)
}
}
- Parameter configuration: The label style to use.
init · iOS 16.0+init
TypeScriptstatic initSystemImage(titleResource: _Foundation_LocalizedStringResource, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, systemImage name: String)
Creates a label with a system icon image and a title generated from a
localized string.
- Parameters:
- titleResource: A title generated from a localized string.
- name: The name of the image resource to lookup.
init · iOS 14.0+init
TypeScriptstatic initSystemImage2271(titleKey: _SwiftUICore_LocalizedStringKey, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, systemImage name: String)
Creates a label with a system icon image and a title generated from a
localized string.
- Parameters:
- titleKey: A title generated from a localized string.
- name: The name of the image resource to lookup.
init · iOS 14.0+init
TypeScriptstatic initSystemImage62115(title: string, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init<S>(_ title: S, systemImage name: String) where S : StringProtocol
Creates a label with a system icon image and a title generated from a
string.
- Parameters:
- title: A string used as the label's title.
- name: The name of the image resource to lookup.
init · iOS 17.0+init
TypeScriptstatic initImage(titleResource: _Foundation_LocalizedStringResource, resource: _DeveloperToolsSupport_ImageResource): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, image resource: ImageResource)
Creates a label with an icon image and a title generated from a
localized string.
- Parameters:
- titleResource: A title generated from a localized string.
- resource: The image resource to lookup.
init · iOS 16.0+init
TypeScriptstatic initImage96328(titleResource: _Foundation_LocalizedStringResource, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, image name: String)
Creates a label with an icon image and a title generated from a
localized string.
- Parameters:
- titleResource: A title generated from a localized string.
- name: The name of the image resource to lookup.
init · iOS 17.0+init
TypeScriptstatic initImage7343(titleKey: _SwiftUICore_LocalizedStringKey, resource: _DeveloperToolsSupport_ImageResource): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, image resource: ImageResource)
Creates a label with an icon image and a title generated from a
localized string.
- Parameters:
- titleKey: A title generated from a localized string.
- resource: The image resource to lookup.
init · iOS 14.0+init
TypeScriptstatic initImage25193(titleKey: _SwiftUICore_LocalizedStringKey, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, image name: String)
Creates a label with an icon image and a title generated from a
localized string.
- Parameters:
- titleKey: A title generated from a localized string.
- name: The name of the image resource to lookup.
init · iOS 17.0+init
TypeScriptstatic initImage11013(title: string, resource: _DeveloperToolsSupport_ImageResource): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init<S>(_ title: S, image resource: ImageResource) where S : StringProtocol
Creates a label with an icon image and a title generated from a string.
- Parameters:
- title: A string used as the label's title.
- resource: The image resource to lookup.
init · iOS 14.0+init
TypeScriptstatic initImage13949(title: string, name: string): Label<_SwiftUICore_Text, _SwiftUICore_Image>
Swift declarationnonisolated init<S>(_ title: S, image name: String) where S : StringProtocol
Creates a label with an icon image and a title generated from a string.
- Parameters:
- title: A string used as the label's title.
- name: The name of the image resource to lookup.
init · iOS 26.0+init
TypeScriptstatic initRoleAction(role: ButtonRole, action: (() => void)): Promise<Button<DefaultButtonLabel>>
Swift declaration@preconcurrency nonisolated init(role: ButtonRole, action: @escaping @MainActor () -> Void)
Creates a button that displays a default label.
For example, the following view would display a button
with a 'x' symbol in the toolbar.
```swift
struct NewContactSheet: View {
var body: some View {
NavigationStack {
NewContactEditor()
.toolbar {
Button(role: .cancel) {
dismissView()
}
}
}
}
}
```
- Parameters:
- role: A semantic role describing the button.
- action: The action to perform when the user triggers the button.
init · iOS 13.0+init
TypeScriptstatic init(configuration: PrimitiveButtonStyleConfiguration): Button<PrimitiveButtonStyleConfiguration_Label>
Swift declarationnonisolated init(_ configuration: PrimitiveButtonStyleConfiguration)
Creates a button based on a configuration for a style with a custom
appearance and custom interaction behavior.
Use this initializer within the
``PrimitiveButtonStyle/makeBody(configuration:)`` method of a
``PrimitiveButtonStyle`` to create an instance of the button that you
want to style. This is useful for custom button styles that modify the
current button style, rather than implementing a brand new style.
For example, the following style adds a red border around the button,
but otherwise preserves the button's current style:
struct RedBorderedButtonStyle: PrimitiveButtonStyle {
func makeBody(configuration: Configuration) -> some View {
Button(configuration)
.border(Color.red)
}
}
- Parameter configuration: A configuration for a style with a custom
appearance and custom interaction behavior.
init · iOS 16.0+init
TypeScriptstatic initRoleAction13932(titleResource: _Foundation_LocalizedStringResource, role: (ButtonRole) | null, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency @export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, role: ButtonRole?, action: @escaping @MainActor () -> Void)
Creates a button with a specified role that generates its label from a
localized string resource.
This initializer creates a ``Text`` view on your behalf. See
``Text`` for more information about localizing strings.
- Parameters:
- titleResource: Text resource for the button's localized title, that
describes the purpose of the button's `action`.
- role: An optional semantic role describing the button. A value of
`nil` means that the button doesn't have an assigned role.
- action: The action to perform when the user triggers the button.
init · iOS 15.0+init
TypeScriptstatic initRoleAction94939(titleKey: _SwiftUICore_LocalizedStringKey, role: (ButtonRole) | null, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency nonisolated init(_ titleKey: LocalizedStringKey, role: ButtonRole?, action: @escaping @MainActor () -> Void)
Creates a button with a specified role that generates its label from a
localized string key.
This initializer creates a ``Text`` view on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
``Text`` for more information about localizing strings.
- Parameters:
- titleKey: The key for the button's localized title, that describes
the purpose of the button's `action`.
- role: An optional semantic role describing the button. A value of
`nil` means that the button doesn't have an assigned role.
- action: The action to perform when the user triggers the button.
init · iOS 15.0+init
TypeScriptstatic initRoleAction99449(title: string, role: (ButtonRole) | null, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency nonisolated init<S>(_ title: S, role: ButtonRole?, action: @escaping @MainActor () -> Void) where S : StringProtocol
Creates a button with a specified role that generates its label from a
string.
This initializer creates a ``Text`` view on your behalf, and treats the
title similar to ``Text/init(_:)``. See ``Text`` for more
information about localizing strings.
- Parameters:
- title: A string that describes the purpose of the button's `action`.
- role: An optional semantic role describing the button. A value of
`nil` means that the button doesn't have an assigned role.
- action: The action to perform when the user interacts with the button.
init · iOS 16.0+init
TypeScriptstatic initAction(titleResource: _Foundation_LocalizedStringResource, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency @export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, action: @escaping @MainActor () -> Void)
Creates a button that generates its label from a localized string
resource.
This initializer creates a ``Text`` view on your behalf. See
``Text`` for more information about localizing strings.
- Parameters:
- titleResource: Text resource for the button's localized title, that
describes the purpose of the button's `action`.
- action: The action to perform when the user triggers the button.
init · iOS 13.0+init
TypeScriptstatic initAction12422(titleKey: _SwiftUICore_LocalizedStringKey, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency nonisolated init(_ titleKey: LocalizedStringKey, action: @escaping @MainActor () -> Void)
Creates a button that generates its label from a localized string key.
This initializer creates a ``Text`` view on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
``Text`` for more information about localizing strings.
- Parameters:
- titleKey: The key for the button's localized title, that describes
the purpose of the button's `action`.
- action: The action to perform when the user triggers the button.
init · iOS 13.0+init
TypeScriptstatic initAction1196(title: string, action: (() => void)): Promise<Button<_SwiftUICore_Text>>
Swift declaration@preconcurrency nonisolated init<S>(_ title: S, action: @escaping @MainActor () -> Void) where S : StringProtocol
Creates a button that generates its label from a string.
This initializer creates a ``Text`` view on your behalf, and treats the
title similar to ``Text/init(_:)``. See ``Text`` for more
information about localizing strings.
- Parameters:
- title: A string that describes the purpose of the button's `action`.
- action: The action to perform when the user triggers the button.
init · iOS 13.0+init
TypeScriptstatic initValueInOnEditingChanged(value: _SwiftUICore_Binding<number>, bounds?: SDKHandle, onEditingChanged?: ((arg0: boolean) => void)): Slider<_SwiftUICore_EmptyView, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<V>(value: Binding<V>, in bounds: ClosedRange<V> = 0...1, onEditingChanged: @escaping (Bool) -> Void = { _ in }) where V : BinaryFloatingPoint, V.Stride : BinaryFloatingPoint
Creates a slider to select a value from a given range.
- Parameters:
- value: The selected value within `bounds`.
- bounds: The range of the valid values. Defaults to `0...1`.
- onEditingChanged: A callback for when editing begins and ends.
The `value` of the created instance is equal to the position of
the given value within `bounds`, mapped into `0...1`.
The slider calls `onEditingChanged` when editing begins and ends. For
example, on iOS, editing begins when the user starts to drag the thumb
along the slider's track.
init · iOS 13.0+init
TypeScriptstatic initValueInStepOnEditingChanged(value: _SwiftUICore_Binding<number>, bounds: SDKHandle, step?: number, onEditingChanged?: ((arg0: boolean) => void)): Slider<_SwiftUICore_EmptyView, _SwiftUICore_EmptyView>
Swift declarationnonisolated init<V>(value: Binding<V>, in bounds: ClosedRange<V>, step: V.Stride = 1, onEditingChanged: @escaping (Bool) -> Void = { _ in }) where V : BinaryFloatingPoint, V.Stride : BinaryFloatingPoint
Creates a slider to select a value from a given range, subject to a
step increment.
- Parameters:
- value: The selected value within `bounds`.
- bounds: The range of the valid values.
- step: The distance between each valid value.
- onEditingChanged: A callback for when editing begins and ends.
The `value` of the created instance is equal to the position of
the given value within `bounds`, mapped into `0...1`.
The slider calls `onEditingChanged` when editing begins and ends. For
example, on iOS, editing begins when the user starts to drag the thumb
along the slider's track.
init · iOS 13.0+init
TypeScriptstatic init(configuration: ToggleStyleConfiguration): Toggle<ToggleStyleConfiguration_Label>
Swift declarationnonisolated init(_ configuration: ToggleStyleConfiguration)
Creates a toggle based on a toggle style configuration.
You can use this initializer within the
``ToggleStyle/makeBody(configuration:)`` method of a ``ToggleStyle`` to
create an instance of the styled toggle. This is useful for custom
toggle styles that only modify the current toggle style, as opposed to
implementing a brand new style.
For example, the following style adds a red border around the toggle,
but otherwise preserves the toggle's current style:
struct RedBorderToggleStyle: ToggleStyle {
func makeBody(configuration: Configuration) -> some View {
Toggle(configuration)
.padding()
.border(.red)
}
}
- Parameter configuration: The properties of the toggle, including a
label and a binding to the toggle's state.
init · iOS 16.0+init
TypeScriptstatic initIsOn(titleResource: _Foundation_LocalizedStringResource, isOn: _SwiftUICore_Binding<boolean>): Toggle<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, isOn: Binding<Bool>)
Creates a toggle that generates its label from a localized string resource.
This initializer creates a ``Text`` view on your behalf. See
`Text` for more information about localizing strings.
- Parameters:
- titleResource: Text resource for the toggle's localized title, that
describes the purpose of the toggle.
- isOn: A binding to a property that indicates whether the toggle is
on or off.
init · iOS 13.0+init
TypeScriptstatic initIsOn40719(titleKey: _SwiftUICore_LocalizedStringKey, isOn: _SwiftUICore_Binding<boolean>): Toggle<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, isOn: Binding<Bool>)
Creates a toggle that generates its label from a localized string key.
This initializer creates a ``Text`` view on your behalf, and treats the
localized key similar to ``Text/init(_:tableName:bundle:comment:)``. See
`Text` for more information about localizing strings.
- Parameters:
- titleKey: The key for the toggle's localized title, that describes
the purpose of the toggle.
- isOn: A binding to a property that indicates whether the toggle is
on or off.
init · iOS 13.0+init
TypeScriptstatic initIsOn19415(title: string, isOn: _SwiftUICore_Binding<boolean>): Toggle<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, isOn: Binding<Bool>) where S : StringProtocol
Creates a toggle that generates its label from a string.
This initializer creates a ``Text`` view on your behalf. See `Text` for more
information about localizing strings.
- Parameters:
- title: A string that describes the purpose of the toggle.
- isOn: A binding to a property that indicates whether the toggle is
on or off.
init · iOS 16.0+init
TypeScriptstatic initOnIncrementOnDecrementOnEditingChanged(titleResource: _Foundation_LocalizedStringResource, onIncrement?: ((() => void)) | null, onDecrement?: ((() => void)) | null, onEditingChanged?: ((arg0: boolean) => void)): Stepper<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, onIncrement: (() -> Void)?, onDecrement: (() -> Void)?, onEditingChanged: @escaping (Bool) -> Void = { _ in })
Creates a stepper that uses a title key and executes the closures
you provide when the user clicks or taps the stepper's increment and
decrement buttons.
Use this initializer to create a stepper with a custom title that
executes closures you provide when either of the stepper's increment
or decrement buttons are pressed. This version of ``Stepper`` doesn't
take a binding to a value, nor does it allow you to specify a range of
acceptable values, or a step value -- it simply calls the closures you
provide when the control's buttons are pressed.
The example below uses an array that holds a number of ``Color`` values,
a local state variable, `value`, to set the control's background
color, and title label. When the user clicks or taps on the stepper's
increment or decrement buttons SwiftUI executes the relevant
closure that updates `value`, wrapping the `value` to prevent overflow.
SwiftUI then re-renders the view, updating the text and background
color to match the current index:
struct StepperView: View {
@State private var value = 0
let colors: [Color] = [.orange, .red, .gray, .blue, .green,
.purple, .pink]
func incrementStep() {
value += 1
if value >= colors.count { value = 0 }
}
func decrementStep() {
value -= 1
if value < 0 { value = colors.count - 1 }
}
var body: some View {
Stepper("Value: \(value) Color: \(colors[value].description)",
onIncrement: incrementStep,
onDecrement: decrementStep)
.padding(5)
.background(colors[value])
}
}

- Parameters:
- titleResource: Text resource for the stepper's localized title
describing the purpose of the stepper.
- onIncrement: The closure to execute when the user clicks or taps
the control's plus button.
- onDecrement: The closure to execute when the user clicks or taps
the control's minus button.
- onEditingChanged: A closure that's called when editing begins and
ends. For example, on iOS, the user may touch and hold the
increment or decrement buttons on a `Stepper` which causes the
execution of the `onEditingChanged` closure at the start and end of
the gesture.
init · iOS 13.0+init
TypeScriptstatic initOnIncrementOnDecrementOnEditingChanged14501(titleKey: _SwiftUICore_LocalizedStringKey, onIncrement?: ((() => void)) | null, onDecrement?: ((() => void)) | null, onEditingChanged?: ((arg0: boolean) => void)): Stepper<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, onIncrement: (() -> Void)?, onDecrement: (() -> Void)?, onEditingChanged: @escaping (Bool) -> Void = { _ in })
Creates a stepper that uses a title key and executes the closures
you provide when the user clicks or taps the stepper's increment and
decrement buttons.
Use this initializer to create a stepper with a custom title that
executes closures you provide when either of the stepper's increment
or decrement buttons are pressed. This version of ``Stepper`` doesn't
take a binding to a value, nor does it allow you to specify a range of
acceptable values, or a step value -- it simply calls the closures you
provide when the control's buttons are pressed.
The example below uses an array that holds a number of ``Color`` values,
a local state variable, `value`, to set the control's background
color, and title label. When the user clicks or taps on the stepper's
increment or decrement buttons SwiftUI executes the relevant
closure that updates `value`, wrapping the `value` to prevent overflow.
SwiftUI then re-renders the view, updating the text and background
color to match the current index:
struct StepperView: View {
@State private var value = 0
let colors: [Color] = [.orange, .red, .gray, .blue, .green,
.purple, .pink]
func incrementStep() {
value += 1
if value >= colors.count { value = 0 }
}
func decrementStep() {
value -= 1
if value < 0 { value = colors.count - 1 }
}
var body: some View {
Stepper("Value: \(value) Color: \(colors[value].description)",
onIncrement: incrementStep,
onDecrement: decrementStep)
.padding(5)
.background(colors[value])
}
}

- Parameters:
- titleKey: The key for the stepper's localized title describing
the purpose of the stepper.
- onIncrement: The closure to execute when the user clicks or taps the
control's plus button.
- onDecrement: The closure to execute when the user clicks or taps the
control's minus button.
- onEditingChanged: A closure that's called when editing begins and
ends. For example, on iOS, the user may touch and hold the increment
or decrement buttons on a `Stepper` which causes the execution
of the `onEditingChanged` closure at the start and end of
the gesture.
init · iOS 13.0+init
TypeScriptstatic initOnIncrementOnDecrementOnEditingChanged65471(title: string, onIncrement?: ((() => void)) | null, onDecrement?: ((() => void)) | null, onEditingChanged?: ((arg0: boolean) => void)): Stepper<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, onIncrement: (() -> Void)?, onDecrement: (() -> Void)?, onEditingChanged: @escaping (Bool) -> Void = { _ in }) where S : StringProtocol
Creates a stepper using a title string and that executes closures
you provide when the user clicks or taps the stepper's increment or
decrement buttons.
Use `Stepper(_:onIncrement:onDecrement:onEditingChanged:)` to create a
control with a custom title that executes closures you provide when
the user clicks or taps on the stepper's increment or decrement buttons.
The example below uses an array that holds a number of ``Color`` values,
a local state variable, `value`, to set the control's background
color, and title label. When the user clicks or taps on the stepper's
increment or decrement buttons SwiftUI executes the relevant
closure that updates `value`, wrapping the `value` to prevent overflow.
SwiftUI then re-renders the view, updating the text and background
color to match the current index:
struct StepperView: View {
@State private var value = 0
let title: String
let colors: [Color] = [.orange, .red, .gray, .blue, .green,
.purple, .pink]
func incrementStep() {
value += 1
if value >= colors.count { value = 0 }
}
func decrementStep() {
value -= 1
if value < 0 { value = colors.count - 1 }
}
var body: some View {
Stepper(title, onIncrement: incrementStep, onDecrement: decrementStep)
.padding(5)
.background(colors[value])
}
}

- Parameters:
- title: A string describing the purpose of the stepper.
- onIncrement: The closure to execute when the user clicks or taps the
control's plus button.
- onDecrement: The closure to execute when the user clicks or taps the
control's minus button.
- onEditingChanged: A closure that's called when editing begins and
ends. For example, on iOS, the user may touch and hold the increment
or decrement buttons on a `Stepper` which causes the execution
of the `onEditingChanged` closure at the start and end of
the gesture.
init · iOS 14.0+init
TypeScriptstatic init(configuration: GroupBoxStyleConfiguration): GroupBox<GroupBoxStyleConfiguration_Label, GroupBoxStyleConfiguration_Content>
Swift declarationnonisolated init(_ configuration: GroupBoxStyleConfiguration)
Creates a group box based on a style configuration.
Use this initializer within the ``GroupBoxStyle/makeBody(configuration:)``
method of a ``GroupBoxStyle`` instance to create a styled group box,
with customizations, while preserving its existing style.
The following example adds a pink border around the group box,
without overriding its current style:
struct PinkBorderGroupBoxStyle: GroupBoxStyle {
func makeBody(configuration: Configuration) -> some View {
GroupBox(configuration)
.border(Color.pink)
}
}
- Parameter configuration: The properties of the group box instance being created.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessagePreview(item: string, subject: (_SwiftUICore_Text) | null, message: (_SwiftUICore_Text) | null, preview: SharePreview<string, string>): ShareLink<SDKHandle, string, string, DefaultShareLinkLabel>
Swift declarationnonisolated init<I>(item: I, subject: Text? = nil, message: Text? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) where Data == CollectionOfOne<I>, I : Transferable
Creates an instance that presents the share interface.
Use this initializer when you want the system-standard appearance for
`ShareLink`.
- Parameters:
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
- preview: A representation of the item to render in a preview.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessagePreview59523(title: string, item: string, subject: (_SwiftUICore_Text) | null, message: (_SwiftUICore_Text) | null, preview: SharePreview<string, string>): ShareLink<SDKHandle, string, string, DefaultShareLinkLabel>
Swift declarationnonisolated init<S, I>(_ title: S, item: I, subject: Text? = nil, message: Text? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) where Data == CollectionOfOne<I>, S : StringProtocol, I : Transferable
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
- preview: A representation of the item to render in a preview.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessagePreview55389(titleResource: _Foundation_LocalizedStringResource, item: string, subject: (_SwiftUICore_Text) | null, message: (_SwiftUICore_Text) | null, preview: SharePreview<string, string>): ShareLink<SDKHandle, string, string, DefaultShareLinkLabel>
Swift declaration@export(implementation) nonisolated init<I>(_ titleResource: LocalizedStringResource, item: I, subject: Text? = nil, message: Text? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) where Data == CollectionOfOne<I>, I : Transferable
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleResource: A resource for the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
- preview: A representation of the item to render in a preview.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessagePreview47140(titleKey: _SwiftUICore_LocalizedStringKey, item: string, subject: (_SwiftUICore_Text) | null, message: (_SwiftUICore_Text) | null, preview: SharePreview<string, string>): ShareLink<SDKHandle, string, string, DefaultShareLinkLabel>
Swift declarationnonisolated init<I>(_ titleKey: LocalizedStringKey, item: I, subject: Text? = nil, message: Text? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) where Data == CollectionOfOne<I>, I : Transferable
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleKey: A key identifying the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
- preview: A representation of the item to render in a preview.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessagePreview63925(title: _SwiftUICore_Text, item: string, subject: (_SwiftUICore_Text) | null, message: (_SwiftUICore_Text) | null, preview: SharePreview<string, string>): ShareLink<SDKHandle, string, string, DefaultShareLinkLabel>
Swift declarationnonisolated init<I>(_ title: Text, item: I, subject: Text? = nil, message: Text? = nil, preview: SharePreview<PreviewImage, PreviewIcon>) where Data == CollectionOfOne<I>, I : Transferable
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
- preview: A representation of the item to render in a preview.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage(items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance that presents the share interface.
Use this initializer when you want the system-standard appearance for
`ShareLink`.
- Parameters:
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage61034(titleKey: _SwiftUICore_LocalizedStringKey, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleKey: A key identifying the title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage1013(title: _SwiftUICore_Text, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ title: Text, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage95416(titleResource: _Foundation_LocalizedStringResource, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleResource: A resource for the title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage8002(title: string, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init<S>(_ title: S, items: Data, subject: Text? = nil, message: Text? = nil) where S : StringProtocol
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- items: The item to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage66560(items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance that presents the share interface.
Use this initializer when you want the system-standard appearance for
`ShareLink`.
- Parameters:
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage98901(titleResource: _Foundation_LocalizedStringResource, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleResource: A resource for the title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage83489(titleKey: _SwiftUICore_LocalizedStringKey, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleKey: A key identifying the title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage14241(title: _SwiftUICore_Text, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ title: Text, items: Data, subject: Text? = nil, message: Text? = nil)
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- items: The items to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemsSubjectMessage47445(title: string, items: Array<string>, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<Array<string>, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init<S>(_ title: S, items: Data, subject: Text? = nil, message: Text? = nil) where S : StringProtocol
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- items: The item to share.
- subject: A title for the items to show when sharing to activities
that support a subject field.
- message: A description of the items to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage(item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(item: URL, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<URL>
Creates an instance that presents the share interface.
Use this initializer when you want the system-standard appearance for
`ShareLink`.
- Parameters:
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage67790(item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(item: String, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<String>
Creates an instance that presents the share interface.
Use this initializer when you want the system-standard appearance for
`ShareLink`.
- Parameters:
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage41860(titleKey: _SwiftUICore_LocalizedStringKey, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, item: URL, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<URL>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleKey: A key identifying the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage60070(title: _SwiftUICore_Text, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ title: Text, item: URL, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<URL>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage88991(titleResource: _Foundation_LocalizedStringResource, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, item: URL, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<URL>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleResource: A resource for the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage85657(title: string, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init<S>(_ title: S, item: URL, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<URL>, S : StringProtocol
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage63559(titleResource: _Foundation_LocalizedStringResource, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, item: String, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<String>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleResource: A resource for the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage66349(titleKey: _SwiftUICore_LocalizedStringKey, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, item: String, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<String>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- titleKey: A key identifying the title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage12188(title: _SwiftUICore_Text, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init(_ title: Text, item: String, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<String>
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 16.0+init
TypeScriptstatic initItemSubjectMessage10880(title: string, item: string, subject?: (_SwiftUICore_Text) | null, message?: (_SwiftUICore_Text) | null): ShareLink<SDKHandle, never, never, DefaultShareLinkLabel>
Swift declarationnonisolated init<S>(_ title: S, item: String, subject: Text? = nil, message: Text? = nil) where Data == CollectionOfOne<String>, S : StringProtocol
Creates an instance, with a custom label, that presents the share
interface.
- Parameters:
- title: The title of the share action.
- item: The item to share.
- subject: A title for the item to show when sharing to activities
that support a subject field.
- message: A description of the item to show when sharing to
activities that support a message field. Activities may
support attributed text or HTML strings.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnEditingChangedOnCommit(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, onEditingChanged: ((arg0: boolean) => void), onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, onEditingChanged: @escaping (Bool) -> Void, onCommit: @escaping () -> Void)
Creates a text field with a text label generated from a localized title
string.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnEditingChangedOnCommit40469(title: string, text: _SwiftUICore_Binding<string>, onEditingChanged: ((arg0: boolean) => void), onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, onEditingChanged: @escaping (Bool) -> Void, onCommit: @escaping () -> Void) where S : StringProtocol
Creates a text field with a text label generated from a title string.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnEditingChanged(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, onEditingChanged: ((arg0: boolean) => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, onEditingChanged: @escaping (Bool) -> Void)
Creates a text field with a text label generated from a localized title
string.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnEditingChanged42059(title: string, text: _SwiftUICore_Binding<string>, onEditingChanged: ((arg0: boolean) => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S>(_ title: S, text: Binding<String>, onEditingChanged: @escaping (Bool) -> Void) where S : StringProtocol
Creates a text field with a text label generated from a title string.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
init · iOS 16.0+init
TypeScriptstatic initTextAxis(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, axis: Axis)
Creates a text field with a preferred axis and a text label generated
from a localized title string resource.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextAxis95543(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, axis: Axis)
Creates a text field with a preferred axis and a text label generated
from a localized title string.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextAxis17837(title: string, text: _SwiftUICore_Binding<string>, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, axis: Axis) where S : StringProtocol
Creates a text field with a preferred axis and a text label generated
from a title string.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextPromptAxis(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>, prompt: (_SwiftUICore_Text) | null, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, prompt: Text?, axis: Axis)
Creates a text field with a preferred axis and a text label generated
from a localized title string resource.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextPromptAxis55789(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, prompt: (_SwiftUICore_Text) | null, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, prompt: Text?, axis: Axis)
Creates a text field with a preferred axis and a text label generated
from a localized title string.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextPromptAxis86183(title: string, text: _SwiftUICore_Binding<string>, prompt: (_SwiftUICore_Text) | null, axis: _SwiftUICore_Axis): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, prompt: Text?, axis: Axis) where S : StringProtocol
Creates a text field with a text label generated from a title string.
Specify a preferred axis in which the text field should scroll
its content when it does not fit in the available space. Depending
on the style of the field, this axis may not be respected.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
- axis: The axis in which to scroll text when it doesn't fit
in the available space.
init · iOS 16.0+init
TypeScriptstatic initTextPrompt(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, prompt: Text?)
Creates a text field with a text label generated from a localized title
string resource.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
init · iOS 15.0+init
TypeScriptstatic initTextPrompt18728(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, prompt: Text?)
Creates a text field with a text label generated from a localized title
string.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
init · iOS 15.0+init
TypeScriptstatic initTextPrompt212(title: string, text: _SwiftUICore_Binding<string>, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, prompt: Text?) where S : StringProtocol
Creates a text field with a text label generated from a title string.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnCommit(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, onCommit: @escaping () -> Void)
Creates a text field with a text label generated from a localized title
string.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initTextOnCommit94581(title: string, text: _SwiftUICore_Binding<string>, onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S>(_ title: S, text: Binding<String>, onCommit: @escaping () -> Void) where S : StringProtocol
Creates a text field with a text label generated from a title string.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 18.0+init
TypeScriptstatic initTextSelectionPromptAxis(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>, selection: _SwiftUICore_Binding<(TextSelection) | null>, prompt?: (_SwiftUICore_Text) | null, axis?: (_SwiftUICore_Axis) | null): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>, selection: Binding<TextSelection?>, prompt: Text? = nil, axis: Axis? = nil)
Creates a text field with a binding to the current selection and a text
label generated from a localized title string resource.
The following example shows a text field with a binding to the current selection:
@State private var message: String = ""
@State private var selection: TextSelection? = nil
var body: some View {
TextField(
"Message",
text: $message,
selection: $selection
)
}
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- selection: A ``Binding`` to the variable containing the selection.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field. Defaults to `nil`.
- axis: The axis in which to scroll text when it doesn't fit
in the available space. Defaults to `nil`.
init · iOS 18.0+init
TypeScriptstatic initTextSelectionPromptAxis91809(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>, selection: _SwiftUICore_Binding<(TextSelection) | null>, prompt?: (_SwiftUICore_Text) | null, axis?: (_SwiftUICore_Axis) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>, selection: Binding<TextSelection?>, prompt: Text? = nil, axis: Axis? = nil)
Creates a text field with a binding to the current selection and a text
label generated from a localized title string.
The following example shows a text field with a binding to the current selection:
@State private var message: String = ""
@State private var selection: TextSelection? = nil
var body: some View {
TextField(
"Message",
text: $message,
selection: $selection
)
}
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
- selection: A ``Binding`` to the variable containing the selection.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field. Defaults to `nil`.
- axis: The axis in which to scroll text when it doesn't fit
in the available space. Defaults to `nil`.
init · iOS 18.0+init
TypeScriptstatic initTextSelectionPromptAxis72533(title: string, text: _SwiftUICore_Binding<string>, selection: _SwiftUICore_Binding<(TextSelection) | null>, prompt?: (_SwiftUICore_Text) | null, axis?: (_SwiftUICore_Axis) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S>(_ title: S, text: Binding<String>, selection: Binding<TextSelection?>, prompt: Text? = nil, axis: Axis? = nil) where S : StringProtocol
Creates a text field with a binding to the current selection and a text
label generated from a title string.
The following example shows a text field with a binding to the current selection:
@State private var message: String = ""
@State private var selection: TextSelection? = nil
var body: some View {
TextField(
"Message",
text: $message,
selection: $selection
)
}
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
- Parameters:
- title: The title of the text view, describing its purpose.
- selection: A ``Binding`` to the variable containing the selection.
- text: The text to display and edit.
- prompt: A `Text` representing the prompt of the text field
which provides users with guidance on what to type into the text
field. Defaults to `nil`.
- axis: The axis in which to scroll text when it doesn't fit
in the available space. Defaults to `nil`
init · iOS 26.0+init
TypeScriptstatic initText(titleResource: _Foundation_LocalizedStringResource, text: _SwiftUICore_Binding<string>): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init(_ titleResource: LocalizedStringResource, text: Binding<String>)
Creates a text field with a text label generated from a localized title
string resource.
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- text: The text to display and edit.
init · iOS 13.0+init
TypeScriptstatic initText72718(titleKey: _SwiftUICore_LocalizedStringKey, text: _SwiftUICore_Binding<string>): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init(_ titleKey: LocalizedStringKey, text: Binding<String>)
Creates a text field with a text label generated from a localized title
string.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- text: The text to display and edit.
init · iOS 13.0+init
TypeScriptstatic initText47582(title: string, text: _SwiftUICore_Binding<string>): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S>(_ title: S, text: Binding<String>) where S : StringProtocol
Creates a text field with a text label generated from a title string.
- Parameters:
- title: The title of the text view, describing its purpose.
- text: The text to display and edit.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnEditingChangedOnCommit(titleKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onEditingChanged: ((arg0: boolean) => void), onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<V>(_ titleKey: LocalizedStringKey, value: Binding<V>, formatter: Formatter, onEditingChanged: @escaping (Bool) -> Void, onCommit: @escaping () -> Void)
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnEditingChangedOnCommit83406(title: string, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onEditingChanged: ((arg0: boolean) => void), onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S, V>(_ title: S, value: Binding<V>, formatter: Formatter, onEditingChanged: @escaping (Bool) -> Void, onCommit: @escaping () -> Void) where S : StringProtocol
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- title: The title of the text field, describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnEditingChanged(titleKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onEditingChanged: ((arg0: boolean) => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<V>(_ titleKey: LocalizedStringKey, value: Binding<V>, formatter: Formatter, onEditingChanged: @escaping (Bool) -> Void)
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnEditingChanged87895(title: string, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onEditingChanged: ((arg0: boolean) => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S, V>(_ title: S, value: Binding<V>, formatter: Formatter, onEditingChanged: @escaping (Bool) -> Void) where S : StringProtocol
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- title: The title of the text field, describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onEditingChanged: The action to perform when the user
begins editing `text` and after the user finishes editing `text`.
The closure receives a Boolean value that indicates the editing
status: `true` when the user begins editing, `false` when they
finish.
init · iOS 16.0+init
TypeScriptstatic initValueFormatterPrompt(titleResource: _Foundation_LocalizedStringResource, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<V>(_ titleResource: LocalizedStringResource, value: Binding<V>, formatter: Formatter, prompt: Text?)
Creates a text field that applies a formatter to a bound
value, with a label generated from a localized title string resource.
Use this initializer to create a text field that binds to a bound
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
"Double",
value: $myDouble,
formatter: numberFormatter
)
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
- prompt: A `Text` which provides users with guidance on what to enter
into the text field.
init · iOS 15.0+init
TypeScriptstatic initValueFormatterPrompt91560(titleKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<V>(_ titleKey: LocalizedStringKey, value: Binding<V>, formatter: Formatter, prompt: Text?)
Creates a text field that applies a formatter to a bound
value, with a label generated from a localized title string.
Use this initializer to create a text field that binds to a bound
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
"Double",
value: $myDouble,
formatter: numberFormatter
)
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
- prompt: A `Text` which provides users with guidance on what to enter
into the text field.
init · iOS 15.0+init
TypeScriptstatic initValueFormatterPrompt28586(title: string, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, prompt?: (_SwiftUICore_Text) | null): TextField<_SwiftUICore_Text>
Swift declarationnonisolated init<S, V>(_ title: S, value: Binding<V>, formatter: Formatter, prompt: Text?) where S : StringProtocol
Creates a text field that applies a formatter to a bound
value, with a label generated from a title string.
Use this initializer to create a text field that binds to a bound
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var label = "Double"
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
label,
value: $myDouble,
formatter: numberFormatter
)
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- title: The title of the text field, describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
- prompt: A `Text` which provides users with guidance on what to enter
into the text field.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnCommit(titleKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<V>(_ titleKey: LocalizedStringKey, value: Binding<V>, formatter: Formatter, onCommit: @escaping () -> Void)
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 13.0+ · Deprecated in iOS 100000.0init
TypeScriptstatic initValueFormatterOnCommit42295(title: string, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter, onCommit: (() => void)): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S, V>(_ title: S, value: Binding<V>, formatter: Formatter, onCommit: @escaping () -> Void) where S : StringProtocol
Create an instance which binds over an arbitrary type, `V`.
- Parameters:
- title: The title of the text field, describing its purpose.
- value: The underlying value to be edited.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
In the event that `formatter` is unable to perform the conversion,
`binding.value` isn't modified.
- onCommit: An action to perform when the user performs an action
(for example, when the user presses the Return key) while the text
field has focus.
init · iOS 16.0+init
TypeScriptstatic initValueFormatter(titleResource: _Foundation_LocalizedStringResource, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<V>(_ titleResource: LocalizedStringResource, value: Binding<V>, formatter: Formatter)
Create an instance which binds over an arbitrary type, `V`.
Use this initializer to create a text field that binds to a bound optional
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
value: $myDouble,
formatter: numberFormatter
) {
Text("Double")
}
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- titleResource: The localized title of the text field,
describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
init · iOS 13.0+init
TypeScriptstatic initValueFormatter40230(titleKey: _SwiftUICore_LocalizedStringKey, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<V>(_ titleKey: LocalizedStringKey, value: Binding<V>, formatter: Formatter)
Create an instance which binds over an arbitrary type, `V`.
Use this initializer to create a text field that binds to a bound optional
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
value: $myDouble,
formatter: numberFormatter
) {
Text("Double")
}
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- titleKey: The key for the localized title of the text field,
describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
init · iOS 13.0+init
TypeScriptstatic initValueFormatter80476(title: string, value: _SwiftUICore_Binding<unknown>, formatter: _Foundation_Formatter): TextField<_SwiftUICore_Text>
Swift declaration@export(implementation) nonisolated init<S, V>(_ title: S, value: Binding<V>, formatter: Formatter) where S : StringProtocol
Create an instance which binds over an arbitrary type, `V`.
Use this initializer to create a text field that binds to a bound optional
value, using a
<doc://com.apple.documentation/documentation/Foundation/Formatter>
to convert to and from this type. Changes to the bound value update
the string displayed by the text field. Editing the text field
updates the bound value, as long as the formatter can parse the
text. If the format style can't parse the input, the bound value
remains unchanged.
Use the ``View/onSubmit(of:_:)`` modifier to invoke an action
whenever the user submits this text field.
The following example uses a
<doc://com.apple.documentation/documentation/Swift/Double>
as the bound value, and a
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter>
instance to convert to and from a string representation. The formatter
uses the
<doc://com.apple.documentation/documentation/Foundation/NumberFormatter/Style/decimal>
style, to allow entering a fractional part. As the user types, the bound
value updates, which in turn updates three ``Text`` views that use
different format styles. If the user enters text that doesn't represent
a valid `Double`, the bound value doesn't update.
@State private var myDouble: Double = 0.673
@State private var numberFormatter: NumberFormatter = {
var nf = NumberFormatter()
nf.numberStyle = .decimal
return nf
}()
var body: some View {
VStack {
TextField(
value: $myDouble,
formatter: numberFormatter
) {
Text("Double")
}
Text(myDouble, format: .number)
Text(myDouble, format: .number.precision(.significantDigits(5)))
Text(myDouble, format: .number.notation(.scientific))
}
}
- Parameters:
- title: The title of the text view, describing its purpose.
- value: The underlying value to edit.
- formatter: A formatter to use when converting between the
string the user edits and the underlying value of type `V`.
If `formatter` can't perform the conversion, the text field doesn't
modify `binding.value`.
method · iOS 14.0+typedPayload
TypeScripttypedPayload(type: "Bool" | "Int" | "UInt" | "Double" | "Float" | "String" | "CGFloat" | "Date" | "URL" | "Data" | "UUID"): unknown
Swift declarationfunc typedPayload<T>(_ type: T.Type) throws -> T where T : Decodable, T : Encodable
Given a Codable Swift type, return an instance decoded from the
NSUserActivity's userInfo dictionary
- Parameter type: the instance type to be decoded from userInfo
- Returns: the type safe instance or raises if it can't be decoded
method · iOS 14.0+setTypedPayload
TypeScriptsetTypedPayload(payload: number): void
Swift declarationfunc setTypedPayload<T>(_ payload: T) throws where T : Decodable, T : Encodable
Given an instance of a Codable Swift type, encode it into the
NSUserActivity's userInfo dictionary
- Parameter payload: the instance to be converted to userInfo
init · iOS 15.0+init
TypeScriptinit(lineStyle: _SwiftUICore_Text_LineStyle): _UIKit_NSUnderlineStyle
Swift declarationinit(_ lineStyle: Text.LineStyle)
Creates a ``NSUnderlineStyle`` from ``Text.LineStyle``.
- Parameter lineStyle: A value of ``Text.LineStyle``
to wrap with ``NSUnderlineStyle``.
- Returns: A new ``NSUnderlineStyle``.
init · iOS 14.0+init
TypeScriptinit(legibilityWeight?: (_SwiftUICore_LegibilityWeight) | null): _UIKit_UILegibilityWeight
Swift declarationinit(_ legibilityWeight: LegibilityWeight?)
Creates a legibility weight from its LegibilityWeight equivalent.
init · iOS 14.0+init
TypeScriptinit(colorScheme?: (_SwiftUICore_ColorScheme) | null): _UIKit_UIUserInterfaceStyle
Swift declarationinit(_ colorScheme: ColorScheme?)
Creates a user interface style from its ColorScheme equivalent.
init · iOS 15.0+init
TypeScriptinit(dynamicTypeSize?: (_SwiftUICore_DynamicTypeSize) | null): _UIKit_UIContentSizeCategory
Swift declarationinit(_ dynamicTypeSize: DynamicTypeSize?)
init · iOS 14.0+init
TypeScriptinit4490(sizeCategory?: (_SwiftUICore_ContentSizeCategory) | null): _UIKit_UIContentSizeCategory
Swift declarationinit(_ sizeCategory: ContentSizeCategory?)
Create a size category from its `ContentSizeCategory` equivalent.
init · iOS 14.0+init
TypeScriptstatic init(edgeInsets: _SwiftUICore_EdgeInsets): { top: number; leading: number; bottom: number; trailing: number }
Swift declarationinit(_ edgeInsets: EdgeInsets)
Create edge insets from the equivalent EdgeInsets.
init · iOS 14.0+init
TypeScriptinit(colorSchemeContrast?: (_SwiftUICore_ColorSchemeContrast) | null): _UIKit_UIAccessibilityContrast
Swift declarationinit(_ colorSchemeContrast: ColorSchemeContrast?)
Create a contrast from its ColorSchemeContrast equivalent.
init · iOS 14.0+init
TypeScriptinit(sizeClass?: (_SwiftUICore_UserInterfaceSizeClass) | null): _UIKit_UIUserInterfaceSizeClass
Swift declarationinit(_ sizeClass: UserInterfaceSizeClass?)
Creates a UIKit size class from the specified SwiftUI size class.
init · iOS 14.0+init
TypeScriptinit(layoutDirection: _SwiftUICore_LayoutDirection): _UIKit_UITraitEnvironmentLayoutDirection
Swift declarationinit(_ layoutDirection: LayoutDirection)
Create a direction from its LayoutDirection equivalent.
static · iOS 18.0+animate
TypeScriptstatic animate(animation: _SwiftUICore_Animation, changes: (() => void), completion?: ((() => void)) | null): Promise<void>
Swift declaration@MainActor @preconcurrency static func animate(_ animation: Animation, changes: () -> Void, completion: (() -> Void)? = nil)
Animate changes to one or more views using the specified SwiftUI
animation.
Animations performed using this method can be smoothly retargeted while
preserving velocity, just like animations in SwiftUI views.
```
Task {
// Begin animation
UIView.animate(.spring(duration: 1.0)) {
myView.center = CGPoint(x: 200, y: 200)
}
try await Task.sleep(for: .seconds(0.5))
// Retarget running animations
UIView.animate(.spring) {
myView.center = CGPoint(x: 100, y: 400)
}
}
```
- Note: When a SwiftUI animation is used for UIView animations, the
animations are run in-process, and are not backed by `CAAnimation`s.
- Parameters:
- animation: The animation to use for the changes.
- changes: A closure containing the changes to animate.
- completion: A closure to execute after the animation completes.
init · iOS 14.0+init
TypeScriptstatic init(color: _SwiftUICore_Color): _UIKit_UIColor
Swift declarationconvenience init(_ color: Color)