MrDatabase
MrDatabase

Reputation: 44455

Searching in iOS apps

I want to store about 10000 strings in my iOS app. I want the ability to quickly search these strings (similar to searching on the devices themselves when you swipe to the left of the home screen). Searching should include a form of "suggest" or auto-complete. For example typing "food" into the search box should bring up a list containing "food stores" "food recipes" etc.

How can I implement this type of search? Perhaps a sqlLite database and ... ?

Cheers!

Upvotes: 0

Views: 484

Answers (2)

Nikita Leonov
Nikita Leonov

Reputation: 5694

Depends on a case you can follow two ways:

  1. Integrate Core Data as Diederik Hoogenboom suggested.

  2. Use filteredArrayUsingPredicate method of NSArray and build a predicate for your needs as described in following document Predicate Programming Guide

    I am personally prefer option #2, it is easier to start and depends on solution's performance and memory footprint you can always switch to more complex #1 option.

Upvotes: 1

diederikh
diederikh

Reputation: 25271

Have a look at Core Data

Upvotes: 2

Related Questions