What is the fastest way to search through strings in Objective-C?

Viewed 3361

I am implementing a sort of autocomplete for an iOS app. The data I am using for the autocomplete values is a comma-separated text file with about 100,000 strings. This is what I am doing now:

  1. Read the text file, and create an NSArray with 100,000 NSString.
  2. As the user types, do [array containsObject:text]

Surely there is a better/faster way to do this lookup. Any thoughts?

2 Answers
Related