VFNetwork is a protocol-oriented network layer that will help you assemble your requests in just a few steps.

Overview

GitHub Light GitHub Dark

Build Version SPM License Platform

Simple, Fast and Easy.

Introduction

VFNetwork is a protocol-oriented network layer that will help you assemble your requests in just a few steps.

How to use

Basically, you need two files to assemble your requests and put Base_URL, Protocol and Environment in your info.plist.

Info.plist

Yout Plist

You have 3 types of Environments for you choose.

enum EnvironmentCase: String {
    case production = "production"
    case sandbox = "sandbox"
    case mock = "mock"
}

HomeAPI.swift

Here you will configure your requests.

import VFNetwork

enum HomeAPI {
    case joke
    case categories
}

extension HomeAPI: APIBuilder {
    
    var path: URLPath {
        switch self {
        case .joke:
            return .plain("jokes/random")
        case .categories:
            return .plain("jokes/categories")
        }
    }
    
    var httpMethod: HTTPMethods {
        switch self {
        case .joke, .categories:
            return .get
        }
    }
    
    var headers: HTTPHeader {
        .custom([
            .bearer("yourToken"),
            .basic("yourBase64"),
            .header("custom", "header")
        ])
    }
    
    var task: HTTPTask {
        switch self {
        case .joke, .categories:
            return .request
        }
    }
    

HomeService.swift

And here you will execute your requests.

import VFNetwork

class HomeService: RequestService {
    func getJoke(completion: @escaping (ResultError>) -> Void) {
        execute(.joke, responseType: JokeModel.self, completion: completion)
    }
    
    func getCategories(completion: @escaping (ResultError>) -> Void) {
        execute(.categories, responseType: CategoryModel.self, completion: completion)
    }
}

That's it. enjoy...

Documentation

All documentation can be found in our Site including detailed api instructions and more.

Requirements

Installation

VFNetwork is available through CocoaPods. To install it, simply add to your Podfile:

target 'YourApp' do
  use_frameworks!

  # Pods for YourApp

  pod 'VFNetwork'

end

Author

Victor Freitas | iOS Developer

License

VFNetwork is available under the MIT license. See the LICENSE file for more info.

You might also like...
Elegant network abstraction layer in Swift.
Elegant network abstraction layer in Swift.

Elegant network abstraction layer in Swift. 中文 Design Features Requirements Communication Installation Usage Base Usage - Target - Request - Download

Lightweight network abstraction layer, written on top of Alamofire
Lightweight network abstraction layer, written on top of Alamofire

TRON is a lightweight network abstraction layer, built on top of Alamofire. It can be used to dramatically simplify interacting with RESTful JSON web-

A generic network layer written in swift

SwiftyNet 1.0.0 A generic network layer written in swift. you can use it as an abstraction layer above Alamofire with generic returned types. Installa

Generic Network Layer created using Swift.

Generic-Network-Layer_iOS Generic Network Layer created using URLSession. Networking is an essential element in app development, and you'll need API c

NSURLSession network abstraction layer, using Codable and Decodable for response and Encodable for request. ⚙️🚀
NSURLSession network abstraction layer, using Codable and Decodable for response and Encodable for request. ⚙️🚀

SONetworking NSURLSession network abstraction layer, using Codable and Decodable for response and Encodable for request. Project Folder and File Struc

Alamofire network layer

NVNetworkRequest Alamofire network layer Installation Add this to your Package dependencies: dependencies: [ .package(url: "https://github.com/vin

Network abstraction layer written in Swift.
Network abstraction layer written in Swift.

Moya 15.0.0 A Chinese version of this document can be found here. You're a smart developer. You probably use Alamofire to abstract away access to URLS

Async network layer with Combine
Async network layer with Combine

Version 1.0.10 Currently Available Platform Version iOS 12.0 tvOS 10.0 macOS 10.15 watchOS 3.0 macCatalyst 13.0 Hover is a Network layer which uses Ap

iOS 15, MVVM, Async Await, Core Data, Abstract Network Layer, Repository & DAO design patterns, SwiftUI and Combine
iOS 15, MVVM, Async Await, Core Data, Abstract Network Layer, Repository & DAO design patterns, SwiftUI and Combine

iOS 15, MVVM, Async Await, Core Data, Abstract Network Layer, Repository & DAO design patterns, SwiftUI and Combine

Releases(1.4.2)
  • 1.4.2(Jun 14, 2022)

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Easy and lightweight network layer for creating different set of network requests like GET, POST, PUT, DELETE customizable with coders conforming to TopLevelDecoder, TopLevelEncoder

Igor 2 Sep 16, 2022
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application. Install Carthage

Ronan Rodrigo Nunes 89 Dec 26, 2022
Say goodbye to the Fat ugly singleton Network Manager with this Network Layer

MHNetwork Protocol Oriented Network Layer Aim to avoid having bloated singleton NetworkManager Philosophy the main philosophy behind MHNetwork is to h

Mohamed Emad Hegab 19 Nov 19, 2022
Restofire is a protocol oriented networking client for Alamofire

Restofire is a protocol oriented networking client for Alamofire. Features Requirements Installation Usage License Features Global Configuration for h

Restofire 381 Sep 29, 2022
A resource based, protocol oriented networking library designed for pure-SwiftUI applications.

Monarch ?? - WIP A resource based, protocol oriented networking library designed for pure-SwiftUI applications. Features: Async/Await Resource Based P

Emilio Pelaez Romero 4 Oct 17, 2022
CoreNetwork module with the basic functionality of requests to the network

CoreNetwork module with the basic functionality of requests to the network

Moscow Metro 4 Apr 27, 2022
Menet is a TCP network middleware that can be dynamically modified through HTTP requests.

Menet Menet is a TCP network middleware that can be dynamically modified through HTTP requests. This is an experimental project, do NOT use it in prod

Nik 2 May 19, 2022
A Combine-style wrapper around Network's NWConnection with a UDP protocol

A Combine-style wrapper around Network's NWConnection with a UDP protocol

Emlyn Bolton 3 Sep 26, 2022
Dratini is a neat network abstraction layer.

Dratini Dratini is a neat network abstraction layer. If you are looking for a solution to make your network layer neat, Dratini is your choice. Dratin

Kevin Lin 37 Jan 29, 2022
Network abstraction layer written in Swift.

Moya 14.0.0 A Chinese version of this document can be found here. You're a smart developer. You probably use Alamofire to abstract away access to URLS

Moya 14.4k Jan 1, 2023