This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (key, value) in components { | |
if (value === f) { | |
let component = components.removeValueForKey(key) | |
println(component) | |
break | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Original by Erica Sadun | |
// Source: http://ericasadun.com/2014/06/24/swift-reflection-dump/ | |
import UIKit | |
import Foundation | |
func typestring(x : Any) -> String | |
{ | |
if let obj = x as? NSObject { | |
return NSStringFromClass((x as NSObject).dynamicType) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
/* | |
Toying with tools to help read binary formats. | |
I've seen lots of approaches in swift that create | |
an intermediate object per-read (usually another NSData) | |
but even if these are lightweight under the hood, | |
it seems like overkill. Plus this taught me about <()> | |
*/ |
NewerOlder