Skip to content

Instantly share code, notes, and snippets.

View inacioferrarini's full-sized avatar

Inácio Ferrarini inacioferrarini

  • São Paulo, SP, Brasil
View GitHub Profile
{
"base": "EUR",
"date": "2017-06-23",
"rates": {
"AUD": 1.4764,
"BGN": 1.9558,
"BRL": 3.7293,
"CAD": 1.4783,
"CHF": 1.0851,
"CNY": 7.6413,
import Foundation
import Quick
import Nimble
@testable import SimpleNetworkLayer
class AnyObjectToRateTransformerSpec: QuickSpec {
override func spec() {
describe("Rates Transformer") {
import Foundation
import Quick
import Nimble
import OHHTTPStubs
@testable import SimpleNetworkLayer
class FixerApiSpec: QuickSpec {
override func spec() {
import UIKit
class AnyObjectToRateTransformer: Transformer {
func transform(_ input: AnyObject?) -> Rates? {
guard let dict = input as? [String : AnyObject] else { return nil }
let base = dict["base"] as? String ?? ""
let date = dict["date"] as? String ?? ""
import Foundation
public protocol Transformer {
associatedtype T
associatedtype U
func transform(_ input: T) -> U
}
import UIKit
class AppBaseApi {
// Properties, Initialization and helpers omited
public func get<Type, TransformerType>(
_ endpointUrl: String,
targetUrl: String,
responseTransformer: TransformerType,
@inacioferrarini
inacioferrarini / ApiClient.swift
Last active June 23, 2017 22:02
ApiClient for ios-simple-network-layer
import Foundation
protocol ApiClient {
var rootUrl: String { get }
}