What Swift Was Missing: How a Developer from Semrush Built New Tools for the Language

The Swift programming language offers powerful capabilities for developing applications for iOS and macOS. However, according to Aleksei Kish, Tech Lead at Semrush and a microservices architecture expert, the ecosystem lacks several critical solutions for working with Swift.

Aleksei Kish
Aleksei Kish

Aleksei found himself facing certain limitations when working in Swift, which inspired him to create and launch a set of tools originally intended to support the development of a GUI client for working with gRPC and gRPC-web. Along the way, he developed three key components: a library with a Swift Proto Reflection mechanism for interacting with any gRPC services and proto files, a Swift Proto Parser for converting proto files into proto descriptors, and the GUI client itself.

Although the original idea was solely to build the GUI client, it quickly became clear that additional tools—namely, Swift Proto Reflection and the Swift Proto Parser—were essential for its development. These libraries now function as standalone tools, already being actively used in practice, while the GUI client remains in development.

Tool 1: SwiftProtoReflect — A Proto Reflection Library for Swift

What It Offers

Like the other tools, SwiftProtoReflect emerged from a practical need. Aleksei found himself missing key functionality in Swift, particularly a tool necessary for creating the GUI client. This led him to develop a library with a Proto Reflection mechanism, enabling clients to automatically fetch information about available gRPC services and methods directly from a server, and then generate or decode proto messages based on that information. Additionally, the library can analyze provided proto descriptors to automatically assemble valid service requests.

In other words, SwiftProtoReflect enables dynamic interaction with gRPC services and methods—eliminating the need to statically generate classes from proto files using protoc. As Aleksei notes, this approach removes the tedious manual effort of creating request and response classes and allows developers to work with gRPC services in a more flexible, automated, and efficient way. It's a powerful tool for handling dynamically changing APIs.

According to Aleksei, the library is especially useful in two scenarios: first, when the server changes (such as updates to methods or data structures), allowing the client to adapt without recompiling the application; and second, when working with multiple different services, enabling seamless interaction with various APIs without constant code generation.

Key Advantages of SwiftProtoReflect Compared to Other Tools

  1. Ability to handle cases where the contract is not known in advance, such as clients interacting with multiple APIs and their versions.
  2. Support for testing, including automated testing.
  3. A range of developer-friendly helper tools.
  4. Ability to build a dynamic client for various integrations.

Notable Features

  • Dynamic Request Building: This is the library's most crucial and unique feature. It enables the analysis of proto file structures and the automatic generation of valid requests based on that information, allowing developers to focus on business logic rather than request formatting.
  • Multi-Service Support: The library can simultaneously interact with multiple gRPC services, allowing developers to choose specific services and methods dynamically.
  • Integration with Existing Tools: SwiftProtoReflect integrates easily into Swift and SwiftUI applications, with support for standard libraries used for networking and gRPC.

How It Works

The library consists of three primary components:

  1. Descriptor System: Manages metadata about Protocol Buffers types, including messages, fields, enums, and services. It operates at runtime without querying the server, working with schema descriptions directly.
  2. Dynamic Message: Uses descriptors to create and manipulate Protocol Buffers messages without code generation. It includes a MessageFactory for instantiating messages and a FieldAccessor for safe field access.
  3. Serialization Layer: Handles conversion between dynamic messages and the Protocol Buffers binary or JSON formats, using the optimized SwiftProtobuf library.

Additionally, the library includes a Type Registry for centralized type management and a Service Client to perform dynamic gRPC calls without generating client code.

Tool 2: Swift Proto Parser — Converting Proto Files into Proto Descriptors

What It Offers

Aleksei's second tool is Swift Proto Parser, a native Swift library for working with Protocol Buffers. It has been released as an open-source library, enabling other developers to benefit from it as well.

Swift Proto Parser parses text proto files into usable data structures. This Swift library reads and analyzes Protocol Buffer definition files (.proto) and provides a native Swift API. "With Swift Proto Parser, developers can build tools for working with proto files entirely within the Swift ecosystem," explains Aleksei. Combined with SwiftProtoReflect, which dynamically works with descriptors, it removes the need for external solutions—a major advantage, as third-party tools don't always integrate smoothly with Swift projects.

Notable Use Cases

This tool doesn't just offer specific features but unlocks a wide range of potential use cases, such as:

1. Custom Documentation Generators

o Online documentation portals: auto-generate service and message descriptions from descriptors.
o Multi-format support (Markdown, HTML, PDF): adapt docs to team needs.
o Visual structure maps: highlight types and relationships between messages and services.

2. Formatters and Linters for Proto Files

o Enforce corporate style: auto-indent, reorder, or rename fields, services, and messages.
o Validate code rules: detect forbidden constructs, unused fields, etc.
o Fast refactoring: mass-rename or move fields based on Swift code logic.

3. Visual Editors and IDE Integrations

o Real-time editing: interactively edit proto files with instant syntax and structure validation.
o IDE plugins: syntax highlighting, autocompletion, validation—all in native Swift.
o API prototyping: assemble new services from existing messages and methods.

4. Migration Tools

o Automate updates of large proto file sets: remove/rename deprecated fields without manual effort.
o Version conflict resolution: analyze differences between branches with visual diffing.

5. Impact Analysis

o Dependency tracking: identify which services/messages are affected by field changes.
o Usage tracing: quickly find where a specific message is used in the code.
o Compatibility alerts: notify users when changes break backward compatibility.

How It Works

According to Aleksei, the dynamic workflow of SwiftProtoParser starts by parsing proto files and generating descriptors. Then, SwiftProtoReflect (or a similar tool) uses those descriptors to dynamically marshal/unmarshal and modify messages. "The advantage is that everything is written in pure Swift—no need to mix in other technologies, which would complicate development," he says.

Tool 3: GUI Client for Working with gRPC and gRPC-Web

What It Offers

The third tool is a GUI client for developers working with gRPC and gRPC-web. Until now, the market has lacked a GUI client that fully addresses the needs of developers working with these technologies. Existing tools were either incomplete or outdated and no longer maintained.

Aleksei explains that the libraries described above were created specifically to enable the development of this GUI client. Without them, building a fully native Swift application would have required using protoc, which would have added significant complexity. "These libraries are standalone products that empower the Swift community to harness the full potential of Protobuf and gRPC—not just for building client/server apps, but also for creating debugging and development tools," he adds.

The GUI application is written in Swift because macOS covers over 90% of the target audience. This platform choice enables iterative feedback collection and regular updates based on real user pain points.

Notable Features

  • Supports gRPC (unary and bidirectional streaming) and gRPC-web.
  • Can send both secure (SSL) and non-secure requests.
  • Displays detailed response metadata.
  • Simple service/project addition using proto files or reflection.
  • Automatically updates services/projects when proto files or reflection signatures change.
  • Intuitive interface for managing project requests.
  • Ability to share projects with team members.
  • Autocomplete when entering request bodies.
  • Environment variable support.
  • Free for individuals and freemium for organizations.

How It Works

The application is built entirely in Swift, which made it significantly easier to develop such a tool. One major hurdle was the lack of Proto Reflection support in Swift—but Aleksei solved this by leveraging his own SwiftProtoReflect library.

For the user interface, SwiftUI was used. The gRPC client was implemented using gRPC Swift, and support for gRPC-web was added to enable the testing of browser-based gRPC applications.

Data storage decisions were tailored to different tasks: Core Data is used for storing application state, SQLite for storing projects, and iCloud/CloudKit for syncing projects across devices and sharing them with team members. UserDefaults is also used to manage app state, user settings, and environment variables.

© 2025 iTech Post All rights reserved. Do not reproduce without permission.

More from iTechPost