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 Localization.swift
protocol Localizable { | |
associatedtype LocalizableKey | |
static var tableName: String? { get } | |
static func localize(key: LocalizableKey, localizer: LocalizerType) -> String | |
} | |
extension Localizable where LocalizableKey: RawRepresentable { | |
static var tableName: String? { |
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>]() |
View AsyncOperation.swift
import Foundation | |
class AsyncOperation: Operation { | |
enum State: String { | |
case isReady, isExecuting, isFinished | |
} | |
override var isAsynchronous: Bool { | |
return true | |
} |