debugging - ”Correct” way to debug print custom classes in Swift -
for custom classes implementing custom debug description following one:
struct scfile: customdebugstringconvertible { let path: string let status: scfilestatus var debugdescription: string { return "<scfile path:\(path), status:\(status)>" } }
what's ”correct” way debug print custom class in swift?
like this?
<scfile path:/path/file.stuff, status:modified>
or this?
scfile(path: "/path/file.stuff", status: scfilestatus.modified)
there isn't "correct" way second seems closer swift does.
an example:
var str = "hello, playground" let range = (range(start: str.startindex, end: str.endindex)) print(range.debugdescription)
prints:
range(0..<17)
Comments
Post a Comment