admaDIC App Development & IT Solutions

Local LLM based AI-Assisted Code Review Comments in Xcode - Part 3

by Annett Schwarze | 2026-04-25

In this series an Xcode Source Editor Extension is built, that analyzes Swift code using a locally running language model (via llama.cpp) and inserts generated review comments directly into the source code as inline annotations.

In this part, we bring everything together so that an actual code snippet can be reviewed by the local LLM.

Starting the Local LLM Server

To start the local LLM server, open a terminal and run the command below. It assumes that your llama.cpp installation directory is located in your home directory.

        
    ~/llama.cpp/build/bin/llama-server -m ~/llama.cpp/models/codellama-7b-instruct.Q4_K_M.gguf -ngl 1 --port 8000
    

▶ Play video in full resolution

Recording Local LLM Test

Starting the Extension

To test the extension, select the `CodeReviewExtension` scheme and click the Run button in Xcode.

With the correct configuration from Part 2 of this series, a second instance of Xcode will launch. This instance is labeled as "inferior", indicating that it is being used for extension testing.

In the testing instance, open any project of your choice and select a code snippet. Then navigate to the "Editor" menu and choose "CodeReviewAssistant" and "AI Code Review".

This triggers the extension, which connects to the local LLM server. The model generates a response, and the extension inserts the resulting review comments directly above the selected code.

▶ Play video in full resolution

Recording Xcode run

Installing the Extension

To install an Xcode Source Editor Extension, it must be embedded within a macOS application. When the application is launched, the extension is registered with the system.

To activate the extension, you can use the `pluginkit` command:

        
    pluginkit -e use -i com.admadic.testlab.CodeReviewAssistant.CodeReviewExtension
    

After activation, Xcode must be fully restarted to recognize the extension. One way to do this is by restarting the relevant service using:

        
    killall -9 com.apple.dt.XCLanguageService
    

Summary

This part brings together all components required to run AI-assisted code reviews locally within Xcode using a Source Editor Extension and a llama.cpp-based setup. The workflow demonstrates how a locally hosted model can analyze selected Swift code and insert contextual review comments directly into the editor.

While smaller, locally running language models have inherent limitations, such as reduced reasoning depth, less accuracy on complex code, and narrower context windows, they still provide meaningful and immediate feedback for many everyday coding tasks. With continued improvements in model efficiency and quality, as well as the ability to fine-tune and customize locally, this approach offers a promising path toward fast, private, and fully offline developer tooling.

 

www.admadic.de | webmaster@admadic.de | Legal Notice and Trademarks | Privacy
© 2005-2007 - admaDIC | All Rights Reserved
All other trademarks and/or registered trademarks are the property of their respective owners
Last Change: Sat Apr 25 07:45:45 2026 GMT