I use Xcode every day, but I know nothing about Xcode. In this article, I will explore what indexing is and how it works. At the end of the article, I have written a simple command-line tool to query the information stored in indexing DataStore.
1\. Xcode Indexing
1.1\. What indexing is
2\. How indexing work
2.1\. Unit file and record file
2.2\. Using IndexStore to query DataStore
2.3\. Xcode Indexing Log
3\. Extend Reading
Indexing support a range of IDE features like code navigation, syntax highlighting, code auto-completion, jump-to-definition, find usages, refactor. You use these features every day as an iOS developer.
When Xcode loads a project that hasn’t been build, it will start indexing the project.
Activity monitor is a handy tool to help you find out the running processes, the Xcode and SKAgent pop up from the list after I open the project.
So, the question is what **SKAgent is? **The SKAgent is the component of SourceKit framework runs the compilation commands to generate the indexing information. The SKAgent executable binary locates at /Applications/Xcode.app/Contents/SharedFrameworks/SourceKit.framework/Versions/A/XPCServices/com.apple.dt.SKAgent.xpc/Contents/MacOS/com.apple.dt.SKAgent
The SKAgent is a XPC Service operated by SourceKit uses the XPCmechanism to communicate with Xcode.
#ios #indexing #clang #xcode