Skip to content

Instantly share code, notes, and snippets.

View volkdmitri's full-sized avatar

Dmitry Volk volkdmitri

View GitHub Profile
@werediver
werediver / BasicServiceLocator.swift
Last active January 14, 2019 06:13
Basic Service Locator pattern implementation in Swift 2.
protocol ServiceLocator {
func getService<T>() -> T?
}
final class BasicServiceLocator: ServiceLocator {
// Service registry
private lazy var reg: Dictionary<String, Any> = [:]
private func typeName(some: Any) -> String {