
Suggestions
From syxUI — written for both platforms, not translated between them.
Autocomplete suggestions.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
SearchSuggestions.swift
// Suggestions · syxUI · https://syxui.dev/components/search-suggestions
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
// Suggestions (autocomplete)
struct SearchSuggestions: View {
var body: some View {
VStack(alignment: .leading, spacing: 0) {
ForEach(Array([("San Francisco, CA", "mappin"), ("San Francisco Giants", "sportscourt"), ("San Fran Coffee", "magnifyingglass")].enumerated()), id: \.offset) { i, s in
HStack(spacing: 12) { Image(systemName: s.1).font(.system(size: 15)).foregroundStyle(.secondary); Group { Text("San Fran").fontWeight(.semibold) + Text(s.0.dropFirst(8)) }.font(.system(size: 15)); Spacer() }.padding(.vertical, 11)
if i < 2 { Divider() }
}
}.frame(width: 320)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


