summaryrefslogtreecommitdiff
path: root/Sora/Views/SearchSuggestionsView.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sora/Views/SearchSuggestionsView.swift')
-rw-r--r--Sora/Views/SearchSuggestionsView.swift32
1 files changed, 17 insertions, 15 deletions
diff --git a/Sora/Views/SearchSuggestionsView.swift b/Sora/Views/SearchSuggestionsView.swift
index b9c3133..91f1f77 100644
--- a/Sora/Views/SearchSuggestionsView.swift
+++ b/Sora/Views/SearchSuggestionsView.swift
@@ -1,21 +1,23 @@
import SwiftUI
struct SearchSuggestionsView: View {
- var tags: [BooruTag]
- @Binding var searchText: String
- var lastSearchTag: String {
- String(searchText.split(separator: " ").last ?? "")
- }
+ var tags: [BooruTag]
+ @Binding var searchText: String
+ var lastSearchTag: String {
+ String(searchText.split(separator: " ").last ?? "")
+ }
- var body: some View {
- ForEach(
- tags.filter { $0.name.lowercased().contains(lastSearchTag)
- }) { suggestion in
- Button {
- searchText.replaceSubrange(searchText.range(of: lastSearchTag)!, with: suggestion.name)
- } label: {
- Text(suggestion.name)
- }
- }
+ var body: some View {
+ ForEach(
+ tags.filter {
+ $0.name.lowercased().contains(lastSearchTag)
+ }
+ ) { suggestion in
+ Button {
+ searchText.replaceSubrange(searchText.range(of: lastSearchTag)!, with: suggestion.name)
+ } label: {
+ Text(suggestion.name)
+ }
}
+ }
}