Skip to content

Instantly share code, notes, and snippets.

@peeblesjs
peeblesjs / gist:9288f79322ed3119ece4
Last active February 11, 2016 23:31
A naive "valueForKey:" operator in Swift
operator infix --> {}
func --> (instance: Any, key: String) -> Any? {
let mirror = reflect(instance)
for index in 0 ..< mirror.count {
let (childKey, childMirror) = mirror[index]
if childKey == key {
return childMirror.value
}
}
@turowicz
turowicz / swift-json-class.md
Last active February 21, 2017 07:00
Apple Swift strong type object serialization to JSON