Created
March 30, 2021 15:25
-
-
Save CrystalKnightCodes/f604ebbb454f77aa246c58a59fe27192 to your computer and use it in GitHub Desktop.
TabView Tutorial Search Bar Method
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
struct SearchBarView: View { | |
//... | |
// MARK: - Methods | |
func findGroup() { | |
results = vacations.all { vacation -> Bool in | |
// First check to see if the text is in the vacation name | |
if vacation.name.localizedCaseInsensitiveContains(text) { | |
return true | |
// If it isn't in the vacation name, search through each place. | |
} else { | |
for place in vacation.places { | |
if place.name.localizedCaseInsensitiveContains(text) { | |
return true | |
} | |
} | |
} | |
return false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment