Arm1.ru

Revamping Documentation with AI

Revamping Documentation with AI

Recently, I’ve been updating docs for the CouchdbClient library. After struggling with some phrases, I decided to try AI to do that for me. Microsoft has Copilot as part of Bing search in the Edge browser.

So, I asked it to generate docs and I was surprised by how good it is. My message was “Improve docs for that Swift code:” followed by the source code of a function.

It got the context correctly, analyzed the source code, described how it works, and what errors it can throw. It even added some comments to the code itself. And I couldn’t have written anything better than this by myself. So, I just asked it to do that for each public function in the library and now I have some nice documentation. And all that for free within the Edge browser. The only limitation is the message length, so I had to send function after function carefully. Using an API should be faster, but since I have only one Swift file, I just used the browser.

Later, I tried Google’s Gemini, which they’re giving access to after the recent I/O. It is also good, but not as good as Copilot. Apple’s DocC doesn’t seem to like the format of the generated documentation (especially Throws section), so some parts were missing. Also, Gemini doesn’t add as many details as Copilot does, so Copilot is my favorite so far:

Revamping Documentation with AI

Time to use AI more often for such routine tasks.
keyboard_return back