Skip to content

Instantly share code, notes, and snippets.

View ernarvaezm's full-sized avatar

Eliecer Narvaez ernarvaezm

View GitHub Profile
szehnder / DataProvider.swift
Last active December 23, 2019 12:13
Pattern for async callback between a view controller and a dataprovider singleton
typealias ServiceResponse = (NSDictionary?, NSError?) -> Void
class DataProvider: NSObject {
var client:AFHTTPRequestOperationManager?
let LOGIN_URL = "/api/v1/login"
class var sharedInstance:DataProvider {
struct Singleton {
static let instance = DataProvider()