Created
August 31, 2020 00:41
-
-
Save atierian/c318752550455427a20a0fa55fba54a5 to your computer and use it in GitHub Desktop.
Debug print all properties in an object in foo = bar form
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
public func mirrorPrint(_ object: Any, terminator: String = "\n") { | |
for child in Mirror(reflecting: object).children { | |
guard let label = child.label else { | |
Swift.print(child.value, terminator: terminator) | |
continue | |
} | |
Swift.print(label, "=", child.value, terminator: terminator) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment