Skip to content
/ Server Public

Asynchronous Swift dynamically configurable network layer.

License

Notifications You must be signed in to change notification settings

bteapot/Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server

Asynchronous Swift dynamically configurable network layer.

Overview

This small library provides solution for most modern Swift application's networking needs. It designed to be dependable on application user's state, dynamically changing it's configuration and request parameters on user authorization or other environment changes. Information exchange – encoding of outgoing data, setting of corresponding request headers, checking response code, decoding received data – is done through single method.

Making a request would be as simple as:

Server.back
    .request(
        type: .post,
        path: "/ping"
    )
    .start()

Or as complex as:

let userCard =
    try await Server.back
        .request(
            type: .post,
            path: "/userinfo",
            query: [
                "id": userID,
            ],
            send: .multipart([
                .png(avatarImage, name: "avatar", filename: "avatar.png"),
                .text(firstName, name: "first_name"),
                .text(lastName, name: "last_name"),
            ]),
            take: .json(UserCard.self)
        )

ReactiveSwift version

ReactiveSwift-flavored Server package is archived in the reactiveswift branch and can be referenced by version tags 1.0.x.

Documentation

Complete Xcode documentation is included with code and its archived version attached to GitHub release page.

Documentation is also available online.