arm1.ru

CouchDB client for Swift 2.3.0

event Aug 1, 2025 at 19:25

CouchDB client for Swift 2.3.0

Recently, I've implemented a feature that I wanted to add to the CouchDB Swift client for a long time. It's Mango Queries support. Finally, it is done in 2.3.0. Feels like the last remaining big feature.

Changelog:

  • Introduced a robust and type-safe MangoQuery API for building complex selectors, projections, sorting, and pagination in CouchDB.
  • Added support for specifying indexes via useIndex in queries to optimize performance.
  • Added first-class support for uploading, downloading, and deleting document attachments (files/images).
  • Comprehensive Attachments API test suite ensures reliability for file operations.
  • Added models and API for creating, listing, and managing Mango indexes (MangoIndex, IndexDefinition).
  • Tutorial and code samples for creating indexes are now included in documentation.
  • Added support for CouchDB Mango _explain endpoint via MangoExplainResponse to inspect how queries are executed and which indexes are used.

CouchDB Client on GitHub | Documentation with examples and tutorials.

A story of one bug in Leaf

event Jul 31, 2025 at 22:18

A story of one bug in Leaf

This website is working on Vapor - a server-side Swift framework. It's pretty old, popular, and well known.

I’ve used it for a few years already and always liked that it's fast and doesn't require a lot of memory on the server.

I'm keeping all dependencies up to date. But recently I've noticed that the website started to eat a lot of memory. It starts with about 20 mb of memory usage, but after a few weeks, I found that it ate about 750 mb on the server.

That's a lot for such a simple website, so I started digging. After reviewing the site code (which I didn't change for a long time), I couldn't find any issues (and AI agents too).

I use Leaf - a template engine from the Vapor team to render HTML. And there was an open issue on their GitHub repo describing exactly the same problem.

So I've asked Copilot to help me debug what's wrong. Pretty quickly, it added some new tests to my fork that did a lot of renders in a cycle. And leak util found retain cycles. So I fixed that with some weak annotation, but during the review of my PR, a maintainer suggested to just use unowned.

And that's it. 2 lines of code fixed memory growth. It's hard to believe, but after a few hours since the deploy, the website still takes only 2 mb of memory. So I'm very proud of myself today.

Morale: contribute to the open-source project that you use.

A Swift package for spell checking using Yandex.Speller

event Jul 10, 2025 at 14:05

A Swift package for spell checking using Yandex.Speller

For my own purposes, I wanted to add a spell checker to one of my apps. It should check the text and automatically correct it. Built-in macOS writing tools work fine for English, but don’t work for Russian.

So after it's done, why not share it?

https://github.com/makoni/YaSpellChecker

SwiftUI text editor for macOS with HTML syntax highlighting

event Jul 9, 2025 at 23:01

SwiftUI text editor for macOS with HTML syntax highlighting

A few months ago, I wanted to add a text editor to one of my apps with HTML syntax highlighting. I tried a couple of libs that I found on GitHub, but none of them really worked for me. Mostly, they are too heavy and try to do everything. And in the end, they are glitchy and buggy.

So inspired by vibe coding, I made my own. It works fine for me and doesn't try to be an IDE or a real code editor. Just a simple SwiftUI view with a text editor with syntax highlighting. Colors are customizable with a simple struct.

Try it on GitHub: https://github.com/makoni/HTMLEditor-SwiftUI

Recent updates of my projects

event Jul 8, 2025 at 19:57

Recently, I've been playing a lot with AI agents, and it really inspired me to update my projects. Playing with real-life tasks makes it more fun.

Couchdb Swift client lib

There are 2 new releases of couchdb-swift library. Copilot kindly added more unit tests to the library to cover more use cases. Mostly failures. I still had to tweak a lot manually, but it gave me some ideas. So I've added more error handling in these 2 recent releases. Also, it found a couple of minor bugs and fixed them, reviewed my PR, and suggested some improvements. Far from being perfect yet, but still pretty impressive.

Release Informer Bot for Telegram

At some moment, I found that Copilot Agent is available for my account, and I can simply start with an issue on GitHub, assign it to the agent, and see what it will do. I've started with a request to update the README for Release Informer Bot with some nice details about how it works and how to set it up.

After the agent finished the updated README, it gave me another idea. Setting up might be automated. So I've opened Visual Studio Code and asked the Copilot agent to add automatic creation of the required database and set it up with the required CouchDB indexes.

It also did a good job, but it still required some manual tweaks and changes. And during that, it led to one more release of the CouchDB client lib because I wanted to rely on a proper "not found" error.

It's hard to tell how much time Copilot saved me. But definitely a lot. Including my favorite automatic string translations. Hopefully, that will inspire me to ship more.

AppMetric 1.13.0

event May 19, 2025 at 08:00

AppMetric 1.13.0

Вышло обновление AppMetric версии 1.13.0. Теперь на Swift 6, слегка подправил UI и убрал открытие поповера при запуске (кроме первого запуска) — пришёл к выводу, что это скорее раздражает, особенно если приложение запускается автоматически после перезагрузки. Ну и добавил локализацию на несколько новых языков.

Загрузить

CouchDB client for Swift version 2

event Apr 16, 2025 at 09:48

CouchDB client for Swift version 2

Recently, I’ve released a few new versions of the CouchDB client for Swift. The latest version is version 2, and it includes several key changes:

  • Updated the minimum required Swift tools version to 6.0.
  • Adopted Swift Concurrency. CouchDBClient has been updated to be an actor.
  • Renamed the library from couchdb-vapor to couchdb-swift to better reflect its purpose as a general CouchDB client for Swift, beyond Vapor-specific use cases.
  • Made some changes to the initializer. Instead of passing a lot of parameters, it now accepts a Config structure.
  • You can pass your own HTTPClient instance to be used in the client.
  • Added translations for error messages.
  • Introduced a dedicated tutorial for integrating CouchDBClient with the Hummingbird server-side framework.
  • Added a shutdown() method to properly release resources associated with the HTTPClient.

CouchDB Client on GitHub | Documentation with examples and tutorials.