My data array is ["Apple", "Pear", "Banana", "Orange"].
If I search Apple, my filteredArray returns "Apple".
However, if I search "apple", it returns nothing.
I tried using the localizedCaseInsensitiveContains method posted as an answer in a similar question but it didn't seem to work for me. Any help is appreciated.
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
filteredArray = dataArray.filter({$0.prefix((textField.text?.count)!) == textField.text!})
tableViewSearch.reloadData()
return true
}