Hello I have a array that has multiple values and I want to try and filter out the index's for my search bar. An Example in English terms would be like. Give me the index for the name "Name2" and do this by checking for all the strings in the first value for each index.
Code:
// Multiple Errors
var receivedList = [["Name1","Apple","Fresh"],["Name2","Orange","Rotten"],["Name3","Pear","Fresh"],["Name4","Grape","Rotten"]]
filteredData = data.filter({$0 == searchBar.text})
filteredData = receivedList.filter({$0 receivedList[1] == searchBar.Text})
//Im not really sure how to use this or if it's even useful
let searchPredicate = NSPredicate(format: "Orange CONTAINS[C] %@", searchText)
let array = (receivedList as NSArray).filtered(using: searchPredicate)
Iv'e checked these pages on here.
filtering-array-of-dictionaries-in-swift
filter-array-of-objects-with-multiple-criteria-and-types-in-swift
And a-couple others, with no luck