I have an array of struct's which each have a title and subtitle:
struct searchItem {
var title: String
var subtitle: String
}
let itemArray: [searchItem] = [
searchItem(title: "Bob", subtitle: "Man"),
searchItem(title: "Susan", subtitle: "Woman"),
searchItem(title: "Joe", subtitle: "Man")
]
var filteredArray = [searchItem]()
Each searchItem's title and subtitle are used to create a tableViewCell in a tableViewController, with a UISearchBar at the top:
I need to somehow filter the itemArray based on the search term, and each searchItem's title and subtitle, So either the search term "Man", or "Bob" will return the individual Bob.
How does one go about doing this? Thanks in advance!