Skip to content

jghg02/NET

Repository files navigation

NET

iOS iOS iOS

This library provee all the necessary logic to make a request to any API from your application. This is an implementation using async and await

Requeriments

  • iOS >= 14
  • macOS >= 10.15

Installation

Add NET Client as a dependency through Xcode or directly to Package.swift:

.package(url: "https://github.com/jghg02/NET", branch: "main")

Usage

struct Recipes: Codable {
    let id: String
    let name: String
    let headline: String
    let image: String?
    let preparationMinutes: Int
}


struct RegistrationError: LocalizedError, Codable, Equatable {
    let status: Int
    let message: String

    var errorDescription: String? { message }
}
    let client = NETClient<[Recipes], RegistrationError>()
    let request = NETRequest(url: URL(string: "https://example.com")!)
    switch await client.request(request) {
    case .success(let data):
        print(data)
    case .failure(let error):
        print("Error")
        print(error.localizedDescription)
    }

About

Network Layer with async and await

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy