Skip to content

Instantly share code, notes, and snippets.

Marco Santarossa MarcoSantarossa

Block or report user

Report or block MarcoSantarossa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SwiftJestTests.swift
import XCTest
@testable import SampleApp
final class SampleAppTests: XCTestCase {
func testExample() {
expect("myValue").not().toBeNil()
expect(5).toBe(5)
View binder.swift
import UIKit
typealias EmptyClosure = () -> Void
final class MyEW {
let onDo: EmptyClosure
init(onDo: @escaping EmptyClosure) {
self.onDo = onDo
}
View CacheLRU.swift
final class CacheLRU<Key: Hashable, Value> {
private struct CachePayload {
let key: Key
let value: Value
}
private let capacity: Int
private let list = DoublyLinkedList<CachePayload>()
private var nodesDict = [Key: DoublyLinkedListNode<CachePayload>]()
@MarcoSantarossa
MarcoSantarossa / AsyncOperation.swift
Last active Apr 9, 2019
How to write and use an asynchronous operation
View AsyncOperation.swift
import Foundation
class AsyncOperation: Operation {
enum State: String {
case isReady, isExecuting, isFinished
}
override var isAsynchronous: Bool {
return true
}
You can’t perform that action at this time.