Skip to content

Instantly share code, notes, and snippets.

@kvs-coder
kvs-coder / ReflectionHashable.swift
Created October 31, 2021 08:27
Reflection Hashable
class MyHashable: Hashable {
var dumped: String {
var str = String()
dump(self, to: &str)
return str
}
static func == (lhs: MyHashable, rhs: MyHashable) -> Bool {
lhs.dumped == rhs.dumped
}
@kvs-coder
kvs-coder / Dependency.swift
Last active July 14, 2021 18:54
Dependency injector
import Foundation
@propertyWrapper
struct Injection<T> {
var wrappedValue: T
init() {
self.wrappedValue = DependencyContainer.getDependency()
}
}