Hashtag Search
Hashtag support
- Build a
Restaurant
model object with name
, streetAddress
, city
, state
, and reviews
properties.
- Build a
Review
model object with a username
and text
property.
- Instantiate an array of
Restaurant
and Review
objects. Make sure that each Restaurant object holds an array of reviews. Add hashtags to some of your reviews or restaruant descriptions. (Use Yelp or Google to help you come up with Restaurants and Reviews)
- Add a
hashtags
computed property to the Restaurant
object that returns an array of any hashtags in the Restaurant
or Review
.
- Check your computed property by printing a list of hashtags of each review and restaurant.
Search
- Add a
SearchableObject
protocol with one function matchesSearchTerm(searchTerm: String)
.
- Implement the function on both model objects.
- Demonstrate your search by printing a list of Restaurants that match a variety of search terms.