Superhighway is a networking library heavily inspired by tiny-networking. It defines an Endpoint type which encapsulates the relationship between a URLRequest and the Decodable entity it represents.
This simply gives us the description of an endpoint, to actually load it, we can pass it to a URLSession:
do {
let (repository, _) = try await URLSession.default.response(for: endpoint)
print("Repository: \(repository)")
} catch {
print("Error: \(error)")
}
If the task is cancelled before it finishes, any networking operations will be halted.
Installing
The recommended way to use Superhighway is through the Swift Package manager. For Xcode projects, simply add this repository to the project’s Swift packages list. For projects using a Package.swift file, add the following:
Other package managers such as CocoaPods and Carthage are officially unsupported, but this entire library is encapsulated in a single Endpoint.swift file which can be copied into an existing project and used as-is.
Superhighway
Superhighway is a networking library heavily inspired by tiny-networking. It defines an
Endpoint
type which encapsulates the relationship between aURLRequest
and theDecodable
entity it represents.A Simple Example
This simply gives us the description of an endpoint, to actually load it, we can pass it to a URLSession:
If the task is cancelled before it finishes, any networking operations will be halted.
Installing
The recommended way to use Superhighway is through the Swift Package manager. For Xcode projects, simply add this repository to the project’s Swift packages list. For projects using a
Package.swift
file, add the following:Other package managers such as CocoaPods and Carthage are officially unsupported, but this entire library is encapsulated in a single
Endpoint.swift
file which can be copied into an existing project and used as-is.