Skip to content

Instantly share code, notes, and snippets.

protocol Dispatcher {
 associatedtype Output
  associatedtype Request
  func execute(request: Request, success: (Output) -> Void, failure: (Error) -> Void)
}
protocol Dispatcher {
func execute(request: URLRequest, success: (Data) -> Void, failure: (Error) -> Void)
}
@lucasecf
lucasecf / NSManagedObject+ActiveRecord.swift
Created November 13, 2015 11:46
Example of extension and subclass of NSManagedObject to use in all models
//
// NSManagedObject+ActiveRecord.swift
// EventCast
//
// Created by Lucas Eduardo on 04/11/15.
// Copyright © 2015 RNCDev. All rights reserved.
//
import Foundation
import CoreData
@lucasecf
lucasecf / ClientExample.swift
Created November 13, 2015 11:40
Example of ClientConfig use with Alamofire
//
// EventClient.swift
// EventCast
//
// Created by Lucas Eduardo on 27/10/15.
// Copyright © 2015 RNCDev. All rights reserved.
//
import Alamofire
@lucasecf
lucasecf / Model.swift
Created November 13, 2015 11:33
Example of a model that implements the ResponseSerializable protocol
//
// Event.swift
// EventCast
//
// Created by Lucas Eduardo on 27/10/15.
// Copyright © 2015 RNCDev. All rights reserved.
//
import Foundation
import CoreData
@lucasecf
lucasecf / ClientConfig.swift
Last active November 15, 2016 03:42
Alamofire serialization example
//
// ClientConfig.swift
// EventCast
//
// Created by Lucas Eduardo on 27/10/15.
// Copyright © 2015 RNCDev. All rights reserved.
//
import Foundation
import Alamofire
@lucasecf
lucasecf / StreamingExample.swift
Last active February 24, 2023 23:16
Example of how to use the streaming feature of the iOS MultipeerConnectivity framework
/*
For this Gist, we have two sides: sender and receiver. The same user can be a sender and a receiver, but I will separate this
two roles to be more clear.
This gist assumes thatyou already have a MCSession created, and the peers are connected,
*/