Mercurial > public > simoleon
diff Simoleon/UI/SearchBar.swift @ 156:84137052813d
Refactor code
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 28 Aug 2021 11:15:25 +0100 |
parents | Simoleon/Helpers/SearchBar.swift@04feeb708833 |
children | 70f0625bfcf1 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Simoleon/UI/SearchBar.swift Sat Aug 28 11:15:25 2021 +0100 @@ -0,0 +1,29 @@ +// +// SearchBar.swift +// Simoleon +// +// Created by Dennis Concepción Martín on 27/07/2021. +// + +import SwiftUI + +struct SearchBar: View { + var placeholder: LocalizedStringKey + @Binding var text: String + + var body: some View { + TextField(placeholder, text: $text) + .disableAutocorrection(true) + .padding(10) + .background( + RoundedRectangle(cornerRadius: 15) + .foregroundColor(Color(.tertiarySystemFill)) + ) + } +} + +struct SearchBar_Previews: PreviewProvider { + static var previews: some View { + SearchBar(placeholder: "Search ...", text: .constant("")) + } +}