Hi everyone,
I’d like to introduce InnoNetwork, a Swift networking package for Apple apps. It focuses on keeping an endpoint’s inputs, response type, and authentication requirement visible, while giving requests a shared place for execution policies and testing.
The starting point is a named endpoint and an async client call. Two separate companion packages cover more specialized needs: InnoNetwork-Protobuf for protobuf HTTP APIs, and InnoNetwork-Stream for HLS media workflows. Neither is required for ordinary JSON requests.
Start with a small, explicit HTTP contract
An endpoint is a struct. The @APIDefinition macro supplies repetitive conformance code, while the response type and inputs remain in your declaration:
import Foundation
import InnoNetwork
struct User: Decodable, Sendable {
let id: Int
let name: String
}
@APIDefinition(method: .get, path: "/users/{id}", auth: .anonymous)
struct GetUser {
typealias APIResponse = User
let id: Int
}
func loadUser(id: Int) async throws(NetworkError) -> User {
let client = DefaultNetworkClient(
baseURL: URL(string: "https://api.example.com/v1")!
)
return try await client.request(GetUser(id: id))
}
This is an illustrative example using the 6.1.1 API; the URL is a placeholder. In an app, the client can be created at the application boundary and reused.
Every endpoint chooses .anonymous, .optional, or .required authentication explicitly. The request API uses throws(NetworkError), and manual APIDefinition conformance remains available when you prefer to write the witnesses yourself.
As requirements grow, you can configure token refresh, retry, caching, and request observation. Refresh coordination can combine concurrent refresh attempts; retry policies account for request replay safety. Consumer test helpers are available through InnoNetworkTestSupport, intended for test targets.
Download, Upload, WebSocket, persistent cache, OpenAPI integration, AWS signing, and public-key pinning are separate products in the same repository. Start by linking only InnoNetwork, then select additional products for the capabilities your app needs.
Add Protobuf when your HTTP API uses generated messages
InnoNetwork-Protobuf connects SwiftProtobuf-generated messages to Core’s public encoded-request pipeline. @ProtobufAPIDefinition declares the endpoint; Core continues to own execution, authentication, retries, and cancellation.
The adapter provides request/response codec policies, media-type checking, and configurable size and nesting limits. It distinguishes an HTTP no-content response from a protobuf Empty message. Schema generation remains in your own build workflow, and gRPC is outside this adapter’s scope.
Add the InnoNetwork-Protobuf package and select its InnoNetwork-Protobuf product. Swift files import InnoNetworkProtobuf. Targets using generated messages also need SwiftProtobuf; the current adapter requires version 1.38.1 or later. Existing adapter 3.x users should read the migration guide: 6.1.1 is a breaking upgrade from that line.
Add Stream for HLS media workflows
InnoNetwork-Stream covers HLS playlists, offline media packages, live/DVR recording, and AVFoundation integration. For example, an app might use Core for its catalog API and Stream for downloading a selected video or recording a bounded live window.
Add the InnoNetwork-Stream package. Its aggregate InnoNetwork-Stream product includes four modules, or you can select individual products: InnoNetworkHLS, InnoNetworkHLSLive, InnoNetworkHLSAVFoundation, and InnoNetworkHLSAudio. Those names also identify the Swift imports. Decoded-audio APIs have additional compiler and OS availability requirements.
Background restoration, protected storage while a device is locked, and FairPlay-provider integration require validation in the consuming app’s device and entitlement context. The release does not establish acceptance for those application-owned scenarios.
Availability and adoption
All three packages have published 6.1.1 releases. Both companions currently pin Core to exactly 6.1.1. The package baseline is Swift 6.2+, iOS/tvOS 16+, macOS 14+, watchOS 9+, and visionOS 1+; Linux is outside the supported platform set. All three are MIT licensed.
Adoption adds endpoint declarations and, by default, macro compilation. For an app with a couple of uncomplicated requests and no shared policy, direct URLSession may remain the simpler choice.
I’d appreciate feedback on the endpoint declarations, the division between Core and the companion packages, and which failure or cancellation example would be most useful to demonstrate next.