Skip to content

Instantly share code, notes, and snippets.

@CrystalKnightCodes
Last active March 30, 2021 15:22
Show Gist options
  • Save CrystalKnightCodes/642468259f2bbc0303ad5f597b8d5c32 to your computer and use it in GitHub Desktop.
Save CrystalKnightCodes/642468259f2bbc0303ad5f597b8d5c32 to your computer and use it in GitHub Desktop.
TabView Tutorial Search Bar View Initial Setup
import SwiftUI
struct SearchBarView: View {
// MARK: - Properties
@State private var text: String = ""
@Binding var results: [Vacation]
// MARK: - View
var body: some View {
VStack(alignment: .leading) {
Text("Search")
.font(.headline)
TextField("Search for a place or a vacation",
text: $text,
onCommit: { findGroup() } // Searches when user hits "return" key.
)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
}
func findGroup() {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment