实例方法
search
searchCompletion(_:)
将完全形成的字符串与此视图的值相关联。
声明
func searchCompletion(_ completion: String) -> some View
参数
text
用作视图完成的字符串。
详述
使用此方法将完整格式的字符串与搜索建议列表上下文中的视图相关联。 The system uses this value when the view is selected to replace the partial text being currently edited of the associated search field.
在 tvOS 上,您提供给 this 修饰符的字符串在显示相关建议和替换搜索字段的部分文本时使用。
SearchPlaceholderView()
.searchable(text: $text) {
Text("🍎").searchCompletion("apple")
Text("🍐").searchCompletion("pear")
Text("🍌").searchCompletion("banana")
}
可用版本
iOS 15.0+, iPadOS 15.0+, macOS 12.0+, Mac Catalyst 15.0+, tvOS 15.0+, watchOS 8.0+
相关用法
- Swift Never saturation(_:)用法及代码示例
- Swift Never simultaneousGesture(_:including:)用法及代码示例
- Swift Never symbolVariant(_:)用法及代码示例
- Swift Never scaledToFill()用法及代码示例
- Swift Never safeAreaInset(edge:alignment:spacing:content:)用法及代码示例
- Swift Never sheet(isPresented:onDismiss:content:)用法及代码示例
- Swift Never submitScope(_:)用法及代码示例
- Swift Never scaleEffect(x:y:anchor:)用法及代码示例
- Swift Never speechAlwaysIncludesPunctuation(_:)用法及代码示例
- Swift Never submitLabel(_:)用法及代码示例
- Swift Never sheet(item:onDismiss:content:)用法及代码示例
- Swift Never scaleEffect(_:anchor:)用法及代码示例
- Swift Never scaledToFit()用法及代码示例
- Swift Never shadow(color:radius:x:y:)用法及代码示例
- Swift Never swipeActions(edge:allowsFullSwipe:content:)用法及代码示例
- Swift Never suggestedFileName(_:)用法及代码示例
- Swift Never scenePadding(_:)用法及代码示例
- Swift Never pageCommand(value:in:step:)用法及代码示例
- Swift Never opacity(_:)用法及代码示例
- Swift Never colorMultiply(_:)用法及代码示例
- Swift Never accessibilityAction(action:label:)用法及代码示例
- Swift Never alert(isPresented:error:actions:message:)用法及代码示例
- Swift Never confirmationDialog(_:isPresented:titleVisibility:actions:)用法及代码示例
- Swift Never flipsForRightToLeftLayoutDirection(_:)用法及代码示例
- Swift Never position(x:y:)用法及代码示例
注:本文由纯净天空筛选整理自apple.com大神的英文原创作品 Never searchCompletion(_:)。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。