Quick start
-
Enable the Xcode extension
Open Comment Writer and choose Xcode Extension. Select Open Extension Settings, then enable Comment Writer in System Settings.
-
Connect an AI service
Choose a provider, add its API key or server address, and select Fetch Models. Choose a model, then select Use This Service.
-
Generate documentation
In Xcode, select one complete Swift declaration. Choose Editor › Code documentation › Analyse and Generate. Comment Writer inserts the generated DocC comment above your selection.
Provider guides
You can configure more than one service, but the Xcode extension uses the provider marked Active and its selected model.
Cloud
OpenAI / Codex
- Create an API key in the OpenAI Platform.
- Paste the key into Comment Writer and select Fetch Models.
- Choose a model, then select Use This Service.
Comment Writer connects to OpenAI through the Responses API. See the OpenAI API quickstart for account and API setup.
Cloud
Anthropic Claude
- Create an API key in the Anthropic Console.
- Paste the key into Comment Writer and select Fetch Models.
- Choose a Claude model, then select Use This Service.
The selected source is sent to Anthropic only when this service is Active. See the Claude API overview for account and API details.
Local
Ollama
- Install Ollama, start it, and download a model from the model library.
- Keep the default address,
http://localhost:11434, and select Fetch Models. - Choose the downloaded model, then select Use This Service.
With the default local address, your selected source stays on your Mac.
Self-hosted
Custom API
- Enter the address of an OpenAI-compatible server. Add a bearer API key if the server requires one.
- Select Fetch Models, or choose Enter Custom Model ID… and enter the exact ID.
- Choose Use This Service.
The server must support /v1/chat/completions. Model discovery also uses /v1/models.
Tips for better documentation
-
Select one complete declaration
Include the signature, attributes, generic constraints, and body so the model has enough context. Generate comments for one declaration at a time.
-
Choose a code-capable model
Models vary in Swift knowledge and response format. If comments are incomplete or inconsistent, try another model offered by the same provider.
-
Confirm the Active service
Fetching or selecting a model does not make that provider active. Select Use This Service after changing providers.
-
Review before committing
Treat generated documentation like generated code: check parameter descriptions, return values, thrown errors, and edge cases before you commit it.
Troubleshooting
The Xcode command is missing
Enable Comment Writer in System Settings › General › Login Items & Extensions › Xcode Source Editor, then restart Xcode. The command appears under Editor › Code documentation.
The command is unavailable
Select at least one complete line of Swift source. If it remains unavailable, confirm that a provider is marked Active and has a selected model in Comment Writer.
No models were found
Check the API key or server address and try Refresh Models. If you know the exact model identifier, choose Enter Custom Model ID… and save it manually.
The service cannot connect
For OpenAI or Anthropic, check your internet connection and API key. For Ollama, confirm the app is running at http://localhost:11434. For a custom API, confirm the server is reachable and OpenAI-compatible.
Generation times out or returns no comment
Try a smaller selection or another model. Some reasoning-focused models can use their response budget before returning documentation; a different code-capable model may work better.
A remote Ollama server cannot connect
Use the server Mac’s private network address and confirm Ollama accepts network connections. Comment Writer allows plain HTTP only for localhost and private network addresses.
Contact support
Still stuck? Use the contact form to report a problem, ask a question, suggest a feature, or share feedback. Include the provider, model, macOS version, and the exact error shown in Comment Writer.