Sample Code
Learning the usage of NSTextFinder, for implementing the elegant find function for your Application.
There are two very interesting properties as below:
textFinder.incrementalSearchingShouldDimContentView = true
textFinder.isIncrementalSearchingEnabled = true
In order to facilitate debugging and clarify the running process, the code adds a lot of console printing. Please forgive me. ๐
The rest of the code refers Developing a Document-Based App.