SwiftlyNetworker - very Ez Netowkrer!! πŸ§‘β€πŸ’»

Overview

SwiftlyNetworker

Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Installation

SwiftlyNetworker is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftlyNetworker'

How to use

enum SojuAPI {
    case list
}

extension SojuAPI: APIable {
    var params: [String : Any]? {
        nil
    }

    var path: String {
        "/TestJSONfile/main/JSON/Test.json"
    }

    var method: HttpMethod {
        .get
    }

    var log: Bool { return false }
}
) in switch result { case .success(let model): print("model \(model)") case .failure(let error): print("error: \(error.localizedDescription)") } } } } ">
import SwiftlyNetworker

// ViewModel
class ViewModel {

    init(
        networker: NetworkerLogic = SwiftlyNetworker(componet: NetworkerLogicDependency)
    ) {
        self.networker = networker
    }

    func request() -> AnyPublisher
   Error> {
        
   return networker.
   request(SojuAPI.
   list).
   eraseToAnyPublisher()
    }

    
   func 
   request(
   complete: 
   @escaping ((Result
   
    Error>) 
    -> 
    Void)) {
        networker.
    request(SojuAPI.
    list, 
    complete: complete)
    }
}



    // UIViewController

    
    class 
    ViewController: 
    UIViewController {

    
    private 
    let viewModel 
    = 
    ViewModel()

    
    override 
    func 
    viewDidLoad() {
        
    super.
    viewDidLoad()

        
    // MARK: - Combine

            viewModel.
    request()
            .
    sink { completion 
    in
                
    switch completion {
                
    case .
    finished
    :
                    
    print(
    "finish")
                
    case .
    failure(
    let error)
    :
                    
    print(
    "error: \(error.localizedDescription)")
                }
            } receiveValue
    : { (
    model: Model) 
    in
                
    print(
    "model \(model)")
            }.
    store(
    in: 
    &cancellables)


        
    // MARK: - Closure

            viewModel.
    request { (
    result: Result
    <Model, 
    Error
    >) 
    in
            
    switch result {
            
    case .
    success(
    let model)
    :
                
    print(
    "model \(model)")
            
    case .
    failure(
    let error)
    :
                
    print(
    "error: \(error.localizedDescription)")
            }
        }
    }
}


   
  

Author

linsaeng, [email protected]

License

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

You might also like...
A very simple Rick & Morty app to demo GraphQL + SwiftUI
A very simple Rick & Morty app to demo GraphQL + SwiftUI

MortyUI A very simple Rick & Morty app to demo GraphQL + SwiftUI Characters Character detail Episode This app have a very simple SwiftUI MVVM architec

A pure Swift library for using ANSI codes. Basically makes command-line coloring and styling very easy!

Colors A pure Swift library for using ANSI codes. Basically makes command-line coloring and styling very easy! Note: Colors master requires Xcode 7.3

A very basic proof-of-concept Swift HTTP server that does not require Foundation

Swift Server Introduction This is very rough and basic HTTP server written in Swift without using Foundation. This is partially based on the Swifter r

A Swift microframework for very easy atomic values.

Atomic Atomic is a fast, safe class for making values thread-safe in Swift. It is backed by pthread_mutex_lock which is the fastest, most-efficient lo

This is pie chart that is very easy to use and customizable design.
This is pie chart that is very easy to use and customizable design.

CSPieChart Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installation CSPieCh

Meet cute and very flexibility library for iOS application for different data view in one circle diagram.
Meet cute and very flexibility library for iOS application for different data view in one circle diagram.

SMDiagramViewSwift Meet cute and very flexibility library for iOS application for different data view in one circle diagram. The opportunity of transf

Very simple Observable and Publisher implementation for iOS apps.

Very simple Observable and Publisher implementation for iOS apps.

A very flexible message bar for iOS written in Swift.
A very flexible message bar for iOS written in Swift.

A very flexible message bar for iOS written in Swift.

🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.
🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.

Verge is giving the power of state-management in muukii/Brightroom v2 development! Verge.swift πŸ“ An effective state management architecture for iOS -

A very simple library to discover and retrieve data from nearby devices (even if the peer app works at background).
A very simple library to discover and retrieve data from nearby devices (even if the peer app works at background).

Discovery: A simple library to discover and retrieve data from nearby devices. Discovery is a very simple but useful library for discovering nearby de

A pure Swift library for using ANSI codes. Basically makes command-line coloring and styling very easy!

Colors A pure Swift library for using ANSI codes. Basically makes command-line coloring and styling very easy! Note: Colors master requires Xcode 7.3

Droplet is a very small SwiftUI application that runs in the menubar and allows a file to be dropped onto the popover.
Droplet is a very small SwiftUI application that runs in the menubar and allows a file to be dropped onto the popover.

A Mac OS menubar application that allows drag-and-drop file uploading to an S3 bucket with a presigned URL copied to the clipboard. Work in progress.

Async GIF image decoder and Image viewer supporting play GIF images. It just use very less memory.
Async GIF image decoder and Image viewer supporting play GIF images. It just use very less memory.

YLGIFImage Asynchronized GIF image class and Image viewer supporting play/stop GIF images. It just use very less memory. Following GIF usually will co

Very easy to use image loader for swift
Very easy to use image loader for swift

Silo Silo is a extremely easy to use and very basic image loader for iOS built in Swift. if you use Silo in your project please let me know! Version 2

🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.
🟣 Verge is a very tunable state-management engine on iOS App (UIKit / SwiftUI) and built-in ORM.

Verge.swift πŸ“ An effective state management architecture for iOS - UIKit and also SwiftUI πŸ“ _ An easier way to get unidirectional data flow _ _ Supp

Very simple swift wrapper for Biometric Authentication Services (Touch ID) on iOS.

SimpleTouch Very simple swift wrapper for Biometric Authentication Services (Touch ID) on iOS. Sample Project There is a SimpleTouchDemo target define

A very useful and unique iOS library to open image picker in just few lines of code.
A very useful and unique iOS library to open image picker in just few lines of code.

ImagePickerEasy A very simple solution to implement UIImagePickerController() in your application. Requirements Swift 4.2 and above Installation Image

A replacement of default action sheet, but has very simple usage
A replacement of default action sheet, but has very simple usage

KPActionSheet A replacement of default action sheet, but has very simple usage. Todo Add more custom affects and styles. Installation CocoaPods KPActi

In this tutorial, you’ll write your very first Core Data application with SwiftUI in Xcode

TodoApp-IOS In this tutorial, you’ll write your very first Core Data application with SwiftUI in Xcode. You’ll see how easy it is to get started with

Owner
LinSaeng
μ œκ°€ λ‹΄λ‹Ήμžκ°€ μ•„λ‹ˆλΌμ„œμš”....
LinSaeng
Displaying very large images in limited memory environments

LargeImageDownsizing in Swift displaying very large images in limited memory environments by turning a large image on disk into a smaller image in mem

ONG_J 2 Oct 22, 2022
Fizz Buzz is a very simple programming task, asked in software developer job interviews.

FizzBuzz Fizz Buzz is a very simple programming task, asked in software developer job interviews. A typical round of Fizz Buzz can be: Write a program

Allan Garcia 1 Jun 6, 2022
Red Torch is a very very (very) simple iOS app that allows you to have a red torch using your screen.

RED Torch Red Torch is a very very (very) simple iOS app that allows you to have a red torch using your screen. The App is based on storyboard, so the

Jakub 0 Jan 1, 2022
Letters animation allows you to click on different letters and accordingly it will animate letters in a cool way. It has a very attractive UI and is very easy to use.

Letters Animation Cool Letters Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

MindInventory 31 Oct 4, 2022
Numbers animation allows you to click on different numbers and accordingly it will animate numbers in a cool way. It has a very attractive UI and is very easy to use.

Numbers Animation Cool Numbers Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

MindInventory 31 Oct 4, 2022
Reading animation allows you to click on the different page numbers and accordingly it will animate page changes in a cool way. It has a very attractive UI and is very easy to use.

Reading Animation Cool Reading Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

MindInventory 42 Oct 4, 2022
BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous loading of images, animation, custom is very high.

BWMCoverView BWMCoverView is a very easy to use advertising the carousel view, supports circular scrolling functions such as switching, asynchronous l

Bi Weiming 31 Mar 10, 2021
Swift APIs for SQLite: Type-safe down to the schema. Very, very, fast. Dependency free.

Lighter Lighter is a set of technologies applying code generation to access SQLite3 databases from Swift, e.g. in iOS applications or on the server. L

Lighter.swift 330 Dec 26, 2022
🍞 Toast for Swift - Toaster Android-like toast with very simple interface

Toaster Android-like toast with very simple interface. (formerly JLToast) Screenshots Features Queueing: Centralized toast center manages the toast qu

Suyeol Jeon 1.6k Jan 3, 2023
SwiftMessages is a very flexible view and view controller presentation library for iOS.

SwiftMessages Overview SwiftMessages is a very flexible view and view controller presentation library for iOS. Message views and view controllers can

SwiftKick Mobile 6.7k Jan 2, 2023