Created
November 20, 2022 21:21
-
-
Save stormychel/e6683e6b6c35e88cea6534c755be65d1 to your computer and use it in GitHub Desktop.
CoreData: NSManagedObject extension that prints all data to console. Usage: nsManagedObjectName.printContent()
This file contains 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
extension NSManagedObject { | |
/// Print content of object to console. | |
func printContent() { | |
print("\nNSManagedObjectID: \(self.objectID) - key/value dump:") | |
for key in self.entity.attributesByName.keys { | |
print("\(key): \(self.value(forKey: key) ?? "nil")") | |
} | |
print("\n") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment