InternationalCodingGuru
InternationalCodingGuru

Reputation: 2258

Store and Retrieve auto-fill text terms, iOS

I have a list of about 10,000 phrases (1-5 words each). When the user starts to type in the searchbar, I want to display a tableview that filters through these phrases to find matches. ie: it will function like auto-fill in your browser.

My question is: What is the best way to store this data? Should I just put it in an array that gets initialized when the user searches? Or should it be stored in an external file?

(I am working with iOS).

Thanks!

Upvotes: 0

Views: 123

Answers (2)

dgund
dgund

Reputation: 3467

Save it in a SQLite or Core Data database. You could also use a .plist file, although that might take longer to read through.

Upvotes: 0

Amit Shah
Amit Shah

Reputation: 4164

You could easily do it with an array, but the performance would be very poor. It would be best to have it in a SQLite (or Core Data) database and search that. I think having it in a file could be even worse performance than the array.

Upvotes: 1

Related Questions