Fix support for Swift 5.4

This commit is contained in:
Ethan Pippin 2021-08-05 11:46:11 -06:00
parent 88389d1044
commit 791a7ae66e
1 changed files with 10 additions and 2 deletions

View File

@ -16,13 +16,21 @@ struct SearchBar: View {
var body: some View {
HStack(spacing: 8) {
// TODO: Clean up the statement as previously done
// in commit 93a25eb9c43eddd03e09df87722c086fb6cb6da4
// after Swift 5.5 is released.
#if os(iOS)
TextField(NSLocalizedString("Search...", comment: ""), text: $text)
.padding(8)
.padding(.horizontal, 16)
#if os(iOS)
.background(Color(.systemGray6))
#endif
.cornerRadius(8)
#else
TextField(NSLocalizedString("Search...", comment: ""), text: $text)
.padding(8)
.padding(.horizontal, 16)
.cornerRadius(8)
#endif
if !text.isEmpty {
Button(action: {
self.text = ""