I am trying to add search support to the Master Data UITableView and started to hit some performance issues. I currently have associations with two NSFetchedResultsController(one for regular and one for searching). In my methods, UISearchDisplayDelegateI release and recreate mine NSFetchedResultsControllerafter each call. However, this causes a delay in typing! Is there a more efficient way to filter NSFetchedResultsController? I set the batch size to about 50 items, and my database has several thousand records, if that matters. Thank!
UITableView
NSFetchedResultsController
UISearchDisplayDelegate
The documentation makes this pretty clear: NSFetchedResultsController
fetchRequest
-executeFetch:
FetchedResultController
NSPredicate *pre = [NSPredicate predicateWithFormat:@"attribute CONTAINS [cd] %@", searchString]; NSArray *searchResults = [[self.fetchedResultsController fetchedObjects] filteredArrayUsingPredicate:pre]
, !
Yes, you can:
Create an instance of NSFetchRequest and change its sort handle every time:
let shortDescriptor = NSSortDescriptor(key: key, ascending: ascending) request.sortDescriptors = [shortDescriptor] do { try fetchedResultViewController?.performFetch() } catch let error as NSError { print("Error in fetch \(error)") }
Read the apple doc: https://developer.apple.com/reference/coredata/nsfetchedresultscontroller
Source: https://habr.com/ru/post/1789174/More articles:How to get variable name types and values in the current class or method in VB.net? - reflectionResources for learning VBA programming in Excel (for a complete programming novice) - vbaКогда ArrayList изменяет размеры, сколько элементов оно добавляет? - javaPostgres SQL statement does not exist; character = integer; - postgresqlC # xml serializer - serialize derived objects - c #How to get the value of the previous row - sqlproblem with side difference output using sdiff on unix - unixObject serialization and deserialization for XML and JSON in Ruby (library)? - ruby | fooobar.comMySQL strength index not working - mysqlHow to make a transition when changing a value in h: selectOneMenu? - spring-webflow-2All Articles