ListPickerItem

public struct ListPickerItem
extension ListPickerItem: View
extension ListPickerItem: _ViewEmptyChecking

ListPickerItem is a view that provides a NavigationLink with a title and selected value(s). And ListPickerDestination is recommended to be used as its destination, for which selection, search filter and customized rows are supported.

Usage

let data = ["first", "second", "third"]
var body: some View {
    ListPickerItem(title: {
        Text("title")
    }, value: {
        Text("value")
    }, axis: .vertical) {
        ListPickerDestination(data,
                              id: \.self,
                              selection: $selection,
                              isTrackingLiveChanges: true,
                              searchFilter: { f, s in f.contains(s) }, rowContent: {
            Text($0)
        })
    }
}

// If you want grouped different sections, the protocol `ListPickerSectionModel` is need be implemented for your element of data.

struct ListPickerSection: ListPickerSectionModel {}
let data = [ListPickerSection(title: "Section 1", items: ["first", "second", "third"]),
            ListPickerSection(title: "Section 2", items: ["apple", "banana", "orange"])]
var body: some View {
    ListPickerItem(title: {
        Text("title")
    }, value: {
        Text("value")
    }, axis: .vertical) {
        ListPickerDestination(data,
                              id: \.self,
                              selection: $selection,
                              isTrackingLiveChanges: true,
                              searchFilter: { f, s in f.contains(s) }, rowContent: {
            Text($0)
        })
    }
}