View

extension View
  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-6royb for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,
                                          placement: SearchFieldPlacement = .automatic, prompt: Text? = nil) -> some View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection, only key paths with String type are allowed.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A Text representing the prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-2ed8t for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase>(text: Binding<String>, collection: ObservedResults<T>,
                                          keyPath: KeyPath<T, String>, placement: SearchFieldPlacement = .automatic,
                                          prompt: LocalizedStringKey) -> some View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    The key for the localized prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-58egp for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,
                                             placement: SearchFieldPlacement = .automatic, prompt: S) -> some View where S: StringProtocol

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A string representing the prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-94bdu for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,
                                             placement: SearchFieldPlacement = .automatic, prompt: Text? = nil, @ViewBuilder suggestions: () -> S)
            -> some View where S: View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A Text representing the prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-1mw1m for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,
                                             placement: SearchFieldPlacement = .automatic, prompt: LocalizedStringKey, @ViewBuilder suggestions: () -> S)
            -> some View where S: View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    The key for the localized prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-6h6qo for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<T: ObjectBase, V, S>(text: Binding<String>, collection: ObservedResults<T>, keyPath: KeyPath<T, String>,
                                                placement: SearchFieldPlacement = .automatic, prompt: S, @ViewBuilder suggestions: () -> V)
    -> some View where V: View, S: StringProtocol

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A string representing the prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-6royb for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,
                                               placement: SearchFieldPlacement = .automatic, prompt: Text? = nil) -> some View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection, only key paths with String type are allowed.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A Text representing the prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-2ed8t for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>,
                                               keyPath: KeyPath<T, String>, placement: SearchFieldPlacement = .automatic,
                                               prompt: LocalizedStringKey) -> some View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    The key for the localized prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:)-58egp for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,
                                                  placement: SearchFieldPlacement = .automatic, prompt: S) -> some View where S: StringProtocol

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A string representing the prompt of the search field which provides users with guidance on what to search for.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-94bdu for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,
                                                  placement: SearchFieldPlacement = .automatic, prompt: Text? = nil, @ViewBuilder suggestions: () -> S)
    -> some View where S: View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A Text representing the prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-1mw1m for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,
                                                  placement: SearchFieldPlacement = .automatic, prompt: LocalizedStringKey, @ViewBuilder suggestions: () -> S)
    -> some View where S: View

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    The key for the localized prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.

  • Note

    See SwiftUI/View/searchable(text:placement:prompt:suggestions) https://developer.apple.com/documentation/swiftui/form/searchable(text:placement:prompt:suggestions:)-6h6qo for more information on searchable view modifier.

    Declaration

    Swift

    public func searchable<Key, T: ObjectBase, V, S>(text: Binding<String>, collection: ObservedSectionedResults<Key, T>, keyPath: KeyPath<T, String>,
                                                     placement: SearchFieldPlacement = .automatic, prompt: S, @ViewBuilder suggestions: () -> V)
    -> some View where V: View, S: StringProtocol

    Parameters

    text

    The text to display and edit in the search field.

    collection

    The collection to be filtered.

    keyPath

    The key path to the property which will be used to filter the collection.

    placement

    The preferred placement of the search field within the containing view hierarchy.

    prompt

    A string representing the prompt of the search field which provides users with guidance on what to search for.

    suggestions

    A view builder that produces content that populates a list of suggestions.