View ModifieriOS 17.0+macOS 14.0+
Overloads
32 ways to call compose().searchable(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().searchable({
text: Binding<string>,
editableTokens: Binding<unknown[]>,
isPresented: Binding<boolean>,
placement?: SwiftUI.SearchFieldPlacement,
prompt: string,
token: ReactNode | ((arg0: Binding<unknown>) => ReactNode),
})@export(implementation) nonisolated func searchable<C>(
text: Binding<String>,
editableTokens: Binding<C>,
isPresented: Binding<Bool>,
placement: SearchFieldPlacement = .automatic,
prompt: LocalizedStringResource,
@ContentBuilder token: @escaping (Binding<C.Element>) -> some View
) -> some View
where C : RandomAccessCollection, C : RangeReplaceableCollection, C.Element : IdentifiableParameters
options.text*Binding<string>The text to display and edit in the search field.
options.editableTokens*Binding<unknown[]>A collection of tokens to display and edit in the search field.
options.isPresented*Binding<boolean>A
Bindingwhich controls the presented state of search.options.placementSwiftUI.SearchFieldPlacementThe preferred placement of the search field within the containing view hierarchy.
options.prompt*stringText resource for the localized prompt of the search field which provides users with guidance on what to search for.
options.token*ReactNode | ((arg0: Binding<unknown>) => ReactNode)A content builder that creates a view given an element in tokens.
Discussion
For more information about using searchable modifiers, see doc:Adding-a-search-interface-to-your-app.
See also
More in Navigation.
- assistiveAccessNavigationIconConfigures the view's icon for purposes of navigation.
- asyncImageURLSessionA modifier that adds a URL session for asynchronous images contained in the view to use when fetching image data.
- contentToolbarPopulates the toolbar of the specified content view type with the views you provide.
- defaultAdaptableTabBarPlacementSpecifies the default placement for the tabs in a tab view using the adaptable sidebar style.
- defaultTabBarPlacementSpecifies the preferred placement for the tabs of a TabView in the TabViewStyle.sidebarAdaptable style on platforms where the tab bar cannot adapt between different representations, and only one representation can be shown.
- navigationBarBackButtonHiddenHides the navigation bar back button for the view.
- navigationBarTitleDisplayModeConfigures the title display mode for this view.
- navigationDestinationAssociates a destination view with a presented data type for use within a navigation stack.
- navigationDocumentConfigures the view's document for purposes of navigation.
- navigationLinkIndicatorVisibilityConfigures whether navigation links show a disclosure indicator.
- navigationSplitViewColumnWidthSets a fixed, preferred width for the column containing this view.
- navigationSubtitleConfigures the view's subtitle for purposes of navigation, using a localized string resource.