Networking

0.1.0

⚡️ URLSession + Combine + Decodable + Generics = <3
freshOS/Networking

What's New

First version of Networking

2020-03-25T13:58:45Z

This version is used in production in our App <3

Networking

Networking

⚠️ Warnign: this is R&D and experimental still. Use at your own risk 👨‍🔬💥

Language: Swift 5 Platform: iOS 13+ SPM compatible License: MIT Build Status codebeat badge Release version

The simplest JSON Networking layer for Swift. Because JSON apis are used in 99% of iOS Apps, this should be simple.

struct Api: NetworkingService {

    let network: NetworkingClient = NetworkingClient(baseURL: "https://jsonplaceholder.typicode.com")

    func fetchPost() -> AnyPublisher<Post, Error> {
        get("/posts/1")
    }

    func fetchPosts() -> AnyPublisher<[Post], Error> {
        get("/posts")
    }
}

// ... later

let api = Api()
api.fetchPost().sink(receiveCompletion: { _ in }) { post in
    // Get back some post \o/
}.store(in: &cancellables)

How

By providing a lightweight client that automates boilerplate code everyone has to write.
By exposing a delightfully simple api to get the job done simply, clearly, quickly.
Getting swift models from a JSON api is now a problem of the past

URLSession + Combine + Generics + Protocols = Networking.

What

  • Build concise Apis
  • Automatically map your models
  • Built-in network logger
  • Pure Swift, Simple & Lightweight
  • Uses Apple's Combine
  • 0 Dependencies

Welcome the future. Bye ws , Hello Networking.

Networking is the next generation of the ws project. The improvements are: Using Combine native Apple's framework over Then Promise Library, removing Arrow dependency to favour Codable (Arrow can still be adatped easily though) and removing the Alamofire dependency in favour of a simpler purely native URLSession implementation.
In essence, less dependencies and more native stuff.

Try it!

Networking is part of freshOS iOS toolset. Try it in an example App ! Download Starter Project

Description

  • Swift Tools 5.1.0

Dependencies

  • None
Last updated: Sun Aug 09 2020 14:33:45 GMT-0500 (GMT-05:00)