A vision for networking in Swift


Greetings, traveler!

Swift Evolution recently published a vision document that looks at networking from a broader angle. It does not introduce a specific API or proposal. Instead, it outlines how networking in Swift could evolve over the next few years and what kind of foundation the ecosystem may move toward.

The document lives in the Swift Evolution repository alongside language proposals, though its role is different. It reads more like a direction-setting piece. The authors describe current issues, sketch a target architecture, and suggest where effort should be concentrated first.

Why this document exists

Networking in Swift has grown in layers. On Apple platforms, URLSession remains the primary entry point. On the server side, SwiftNIO and libraries built on top of it define a different model. There is also Network.framework, which exposes lower-level capabilities.

These tools overlap in functionality but differ in abstractions, concurrency models, and areas of focus. Moving between them often requires rewrites rather than simple adaptation. Even basic concepts such as request and response types are not shared across the ecosystem.

The document calls out this fragmentation directly. It describes a situation where developers need to choose early and then commit to a specific stack. That choice becomes expensive to change later.

The direction: a unified networking model

The core idea is to move toward a more consistent and shared model for networking in Swift. The document proposes a layered approach.

At the bottom, there are common I/O primitives and buffer types. Above that, shared implementations of protocols such as HTTP, TLS, and WebSockets. At the top, developer-facing APIs for clients and servers.

This structure aims to reduce duplication. Instead of each library maintaining its own implementation of HTTP or TLS, those pieces could be reused. Improvements in one place would propagate across the stack.

The proposal also emphasizes interoperability. Libraries should be able to exchange data without adapters or conversions between incompatible models.

Swift concurrency as a foundation

A significant part of the vision focuses on aligning networking APIs with modern Swift. Many existing APIs rely on completion handlers, delegates, or reactive layers. These patterns predate structured concurrency.

The document suggests that future APIs should be built around async/await, structured concurrency, and Sendable types. This shift affects both client and server use cases.

The goal is not to remove existing APIs but to provide a consistent model that fits naturally into the language as it exists today.

Progressive API design

Another theme in the document is how APIs should scale with complexity.

Simple tasks should remain simple. A basic HTTP request should not require knowledge of transport layers or protocol internals. At the same time, advanced use cases such as streaming, custom transports, or fine-grained control over requests should remain accessible.

The authors describe this as a progressive approach. The API surface expands as needed, without forcing every developer to deal with the full complexity from the start.

Shared types across the ecosystem

One of the more concrete directions is the introduction of shared “currency types.” These are types that can be used across libraries without translation.

An example already exists in the form of swift-http-types, which defines HTTPRequest and HTTPResponse. The idea is that both clients and servers can operate on these types, regardless of the underlying implementation.

This reduces friction when combining tools. Middleware, logging, or tracing systems can work with a common model instead of adapting to each framework separately.

Focus areas

The document outlines several areas where work is expected to begin.

HTTP APIs come first. They are the most widely used entry point into networking and affect both application and server development. A new HTTP client API is expected to provide a consistent interface built around Swift concurrency.

Server-side APIs follow a similar idea. There is a gap between high-level frameworks and low-level primitives. The vision suggests a middle layer that provides structured concurrency while still allowing control over streaming and request handling.

Underlying all of this is the need for shared implementations of protocols. Reducing duplication at this level makes the rest of the stack easier to build and maintain.

Relationship to existing technologies

The document does not position itself as a replacement for existing tools. Instead, it describes a path where those tools may gradually align.

URLSession, SwiftNIO, and Network.framework remain relevant. Over time, they may adopt shared primitives or converge toward a more unified model. The details are left open, and the document explicitly frames this as a multi-year effort.

Incremental adoption plays an important role. New types and APIs can appear alongside existing ones, allowing developers to migrate at their own pace.

What this means for iOS developers

For an iOS developer, the immediate impact is limited. Current APIs remain unchanged, and there is no requirement to switch to new abstractions.

The value of this document lies in understanding where the ecosystem may head next. A more unified model could reduce the gap between client and server development. Shared types could make it easier to reuse logic across platforms. Concurrency-first APIs could simplify common networking patterns.

At the same time, the document leaves many details open. It describes intent rather than a finished design.

Closing thoughts

This vision document sets expectations rather than delivering solutions. It captures a sense that networking in Swift has reached a point where consolidation would help both library authors and application developers.

Whether this direction materializes fully depends on future proposals and adoption across the ecosystem. For now, it offers a useful map of where discussions are heading and what problems the Swift community is trying to solve next.