Skip to content
Declarative and Reactive Networking for Swift.
Swift Ruby
Branch: master
Clone or download

Latest commit

Latest commit 4adb658 Apr 28, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows Fix documentation in CI Apr 2, 2020
Sources Fixes #17 Apr 28, 2020
Squid.xcodeproj Add service-level error mapping Apr 28, 2020
Tests Add service-level error mapping Apr 28, 2020
examples Update docs Mar 29, 2020
.gitignore Update to new URL Mar 29, 2020
.jazzy.yaml Update docs Mar 29, 2020
.swiftlint.yml Add service hook support and documentation Mar 18, 2020
LICENSE Update License Jan 24, 2020
Package.swift Add SwiftLint and enable async headers Feb 19, 2020 Update to new URL Mar 29, 2020
Squid.podspec Update to new URL Mar 29, 2020


Cocoapods Build CocoaPods Documentation

Squid is a declarative and reactive networking library for Swift. Developed for Swift 5, it aims to make use of the latest language features. The framework's ultimate goal is to enable easy networking that makes it easy to write well-maintainable code.

In its very core, it is built on top of Apple's Combine framework and uses Apple's builtin URL loading system for networking.


At the moment, the most important features of Squid can be summarized as follows:

  • Sending HTTP requests and receiving server responses.
  • Retrying HTTP requests with a wide range of retriers.
  • Automated requesting of new pages for paginated HTTP requests.
  • Sending and receiving messages over WebSockets.
  • Abstraction of API endpoints and security mechanisms for a set of requests.


When first using Squid, you might want to try out requests against a Test API.

To perform a sample request at this API, we first define an API to manage its endpoint:

struct MyApi: HttpService {

    var apiUrl: UrlConvertible {

Afterwards, we can define the request itself:

struct Todo: Decodable {

    let userId: Int
    let id: Int
    let title: String
    let completed: Bool

struct TodoRequest: JsonRequest {

    typealias Result = Todo
    let id: Int
    var routes: HttpRoute {
        ["todos", id]

And schedule the request as follows:

let api = MyApi()
let request = TodoRequest(id: 1)

// The following request will be scheduled to ``
request.schedule(with: api).ignoreError().sink { todo in 
    // work with `todo` here


Squid is available via the Swift Package Manager as well as CocoaPods.

Swift Package Manager

Using the Swift Package Manager is the simplest option to use Squid. In Xcode, simply go to File > Swift Packages > Add Package Dependency... and add this repository.

If you are developing a Swift package, adding Squid as a dependency is as easy as adding it to the dependencies of your Package.swift like so:

dependencies: [
    .package(url: "")


If you are still using CocoaPods or are required to use it due to other dependencies that are not yet available for the Swift Package Manager, you can include the following line in your Podfile to use the latest version of Squid:

pod 'Squid'


Documentation is available here and provides both comprehensive documentation of the library's public interface as well as a series of guides teaching you how to use Squid to great effect. Expect more guides to be added shortly.


Squid is licensed under the MIT License.

You can’t perform that action at this time.