I'd like to add a find bar (just like the one that appears in Safari, Skim, etc) in the NSTextView of my app.
I'd like to use NSTextView's setUsesFindBar method, but it's a Lion only API at the moment (according to its documentation). It uses the NSTextFinder class, which is also available only in Lion.
My question is how I may be able to replicate this in my app that needs to run on both Snow Leopard and Lion. I could of course use the find panel on SL, but it would be nice to have a consistent look across the two versions.
Are apps like Safari, Skim and so on coding it from scratch in their SL versions?
Any explanations or pointers would be much appreciated.
Unfortunately, you'd need to implement the find bar from scratch for Snow Leopard, there's no API support for it. Safari may use a private implementation of this API in Snow Leopard (I don't know if it does or not) but the developer of Skim has most likely re-implemented it from scratch.
I think that letting Lion users make use of the new functionality while SL users get the old find panel is an appropriate way of dealing with the situation. I don't personally think it's worth going to the effort of re-implementing it for a legacy OS.
Updated: I just did a search for Skim and it appears to be open source. If that is the Skim app you're referring to, then just check out the source and have a look for yourself.