CoreStore icon indicating copy to clipboard operation
CoreStore copied to clipboard

Printing all values in CoreStoreObject?

Open cdelaet opened this issue 7 years ago • 1 comments

Would it be possible to make CoreStoreObject to implement CustomStringConvertible by default? It would be nice if print(myCoreStoreObject) printed all keys and their values out of the box. I use that feature a lot to verify / debug my code.

cdelaet avatar Jan 12 '18 09:01 cdelaet

That’s not what CustomStringConvertible is for. You want CustomReflectable or CustomDebugStringConvertible (I’m not sure why that last one exists).

On a related note, Core Data documentation explicitly discourages overriding description to fire a fault. I implement TextOutputStreamable instead. In fact, I never add conformance to CustomStringConvertible directly, only through LosslessStringConvertible. TextOutputStreamable is more efficient, and takes priority for almost everything. It also doesn’t leave uselessly identical properties everywhere.

Saklad5 avatar May 06 '20 15:05 Saklad5