NetworkKit 2.0 renames every request method for how it is called, and adds
request adapters and bounded retry. Upgrading from 1.x requires code changes —
see the table below.
Breaking changes
Every request method is renamed for how it is called. Overloads no longer
differ only by argument label.
| 1.x | 2.0 |
|---|---|
sendRequest(urlStr:) |
sendRequestUsingURLString(_:) |
sendRequest(endpoint:) |
sendRequestUsingEndpoint(endpoint:) |
sendRequest(endpoint:resultHandler:) |
sendRequestUsingLegacyCallbackAPI(endpoint:resultHandler:) |
sendRequest(endpoint:type:) |
sendRequestUsingCombine(endpoint:type:) |
The endpoint-based async continuation method is removed —
sendRequestUsingEndpoint covers it using URLSession's native async API.
NetworkKit now depends on NetworkKitCore,
so import NetworkKitCore where you conform to RequestAdapting or
RequestRetrying.
Installation
.package(url: "https://github.com/sabapathy7/NetworkKit.git", from: "2.0.0")What's new
- Adapters and retry — mutate a request before it is sent (e.g. auth
tokens) and decide whether failures are retried. Adapters re-run each
attempt so refreshed tokens are picked up;maxRetryCount(default 3)
prevents unbounded retrying. - Percent-encoded path parameters — a
pathParamsvalue containing/
no longer splits the path. NetworkServiceis now a realSendablerather than@unchecked.NetworkErrorconforms toEquatable.- Documentation is now built and hosted on Swift Package Index.
Testing
35 tests — the existing XCTest suite plus a new Swift Testing target covering
all four call styles, adapters and retry, query and path parameters,
concurrency and @MainActor isolation, and stub/fake/mock/spy doubles.
Full Changelog: 1.0.9...2.0.0