Last active
March 30, 2021 15:22
-
-
Save CrystalKnightCodes/642468259f2bbc0303ad5f597b8d5c32 to your computer and use it in GitHub Desktop.
TabView Tutorial Search Bar View Initial Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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