How to search a directory and display search results in a table in Objective-C

319 views Asked by At

I want to create an iTunes style search function where a searchfield will look through the contents of a directory and display the results in an NSTableView.
This would be specifically for music so the searchfield should match either song name, artist name or song name.

Is there a way to do this in Objective-C without having the contents of the directory added into the NSTableView first?

3

There are 3 answers

0
Jason Bugs Adams On

where is the "directory" located? are you talking about an actual directory on your local filesystem? I suggesting populating an array with the contents of a directory listing and then using on of the many howto's to get a search to populate a tableView.

http://cocoadev.com/index.pl?NSTableViewTutorial lesson 6

1
Rob Napier On

This is generally what SearchKit is for. It gives you access to the spotlight metadata, so that you can search for information like this very quickly.

0
Jay On

You'll want to use Spotlight for searching meta-data like artists and other song information:

SearchKit focus OTOH is on content search.