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

Last update: Jun 14, 2022

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.

GitHub

https://github.com/vafreitas/VFNetwork
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

Jan 29, 2022

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-

Jun 17, 2022

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

Oct 11, 2021

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

Jun 16, 2022

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

Jan 28, 2022

Alamofire network layer

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

Nov 19, 2021

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

Jun 22, 2022

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

Jun 16, 2022

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

Jun 16, 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

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

Jun 7, 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.

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

Jan 21, 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

Apr 6, 2022
Restofire is a protocol oriented networking client for Alamofire
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

Feb 2, 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

May 27, 2022
CoreNetwork module with the basic functionality of requests to the network

CoreNetwork module with the basic functionality of requests to the network

Apr 27, 2022
Menet is a TCP network middleware that can be dynamically modified through HTTP requests.
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

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

Apr 12, 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

Jan 29, 2022
Network abstraction layer written in Swift.
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

Jun 23, 2022