forked from SAP/cloud-sdk-ios-fiori
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SearchWithBookmark.swift
39 lines (35 loc) · 1.2 KB
/
SearchWithBookmark.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import FioriThemeManager
import SwiftUI
struct SearchWithBookmark: View {
@State private var queryString = ""
@State private var searchScope = SearchScope.all
// var delegate = MyUISearchBarDelegate()
var body: some View {
NavigationStack {
List(ColorEntity.filterColors(queryString, scope: searchScope)) { color in
Text(color.name)
.foregroundColor(color.fioriColor)
}
.navigationTitle("Colors")
}
.searchable(text: $queryString, prompt: "Color name")
.navigationBarTitleDisplayMode(.inline)
.onAppear {
// UISearchBar.appearance().delegate = delegate // SwiftUI doesn't support bookmark actions.
UISearchBar.appearance().showsBookmarkButton = true // bookmark shown
// UISearchBar.appearance().setImage(Image(systemName: "checkmark").asUIImage(), for: .bookmark, state: .normal)
}
}
}
// class MyUISearchBarDelegate: NSObject, UISearchBarDelegate {
// override init() {
//
// }
//
// func searchBarBookmarkButtonClicked(_ searchBar: UISearchBar) {
// print("Bookmark button clicked")
// }
// }
#Preview {
SearchWithBookmark()
}