Skip to content

stantmob/Retrofire

Repository files navigation

Retrofire

Retrofire is a framework written in swift that generate API requests and build models elegantly. We combine two powerful libs, Alamofire and SwiftyJSON to generate a better response to you.

  • Features
  • Instalation
  • Usage
  • Goals

Retrofire turns your HTTP API into a swift protocol.

Protocol implementation sample

Retrofire class generates an implementation of the sample interface.

remoteBuilder implementation sample

Features

  • Do API requests
  • Build response objects
  • error handle

Instalation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate Retrofire into your Xcode project using CocoaPods, specify it in your Podfile:

sample with podfile

Then run:

$ pod install

Usage

Making a single request

var response: ResponseObject?
remoteBaseImpl.findPost(id: 1)
  .onSuccess() { responseObject in
    response = responseObject
  }
  .call()

Request a list

var responses: [ResponseObject]?
remoteBaseImpl.posts()
.onSuccess() { responseObjects in
    responses = responseObjects
    }
.call()

Building model

building model sample

Response handling

subtitle explain how to do a simple request

request sample

Response hander

subtitle explain response handler

request sample

Goals

  • select thread to run
  • Multi part request

About

Simply and elegant HTTP Networking in Swift. Based on Alamofire and Retrofit

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •