Bolt-swift 6.0 - Modernized for Swift 6 and Neo4j 5.x
It's been a while since Bolt-swift got some love. The library has been quietly working away for many users, but Swift has evolved significantly since the last major release, and Neo4j has moved on, so it was time for an update.
The main driver for this release was getting the library to work with modern Neo4j versions. I kept getting reports that connections to Neo4j 5.x were failing. Now the library works across the full spectrum from Neo4j 3.5 all the way to Neo4j 2025.12.1.
While I was in there, I took the opportunity to modernize the codebase for Swift 6. The library now uses Swift's structured concurrency with async/await, which makes for much cleaner code than the old EventLoopFuture-based approach. You can now write queries like this:
let connection = try await Connection.connect(
hostname: "localhost",
port: 7687,
username: "neo4j",
password: "password"
)
let result = try await connection.runAsync(
statement: "MATCH (n:Person) RETURN n.name LIMIT 10"
)
for record in result.records {
print(record)
}
Another significant improvement is proper support for Bolt 5.1's separate authentication flow. In older Bolt versions, credentials were sent as part of the HELLO message. Bolt 5.1 and later require a separate LOGON message after HELLO. The library now handles this automatically based on the negotiated protocol version.
For those connecting to Neo4j Aura, TLS handling is now fixed so that cloud connections work properly.
The library has been tested against:
- Neo4j 3.5 (legacy, but still in use)
- Neo4j 4.4 (LTS)
- Neo4j 5.26 (current stable)
- Neo4j 2025.12.1 (latest)
All tests pass on both macOS and Linux.
I've also added DocC documentation, so you can now generate proper API
docs with swift package generate-documentation. Not the most exciting
feature, but it makes the library easier to explore and easier to point your LLM to for implentation.
The library is available on GitHub at neo4j-swift/Bolt-swift, and you can add it to your project via Swift Package Manager:
.package(url: "https://github.com/neo4j-swift/Bolt-swift.git", from: "6.0.0")
If you're using an older version, the migration should be straightforward - the public API hasn't changed dramatically, just modernized. The main change is that many methods now have async variants that you'll probably want to use instead of the callback-based ones.
Let me know if you run into any issues. The GitHub issue tracker is the best place for bug reports and feature requests.