buildasaurs / XcodeServerSDK

Access Xcode Server API with native Swift objects.
MIT License
399 stars 30 forks source link

Use CustomStringConvertible for description #97

Closed drewcrawford closed 9 years ago

drewcrawford commented 9 years ago

This yields string interpolation.

Should probably be done elsewhere in this codebase, but this is the one I need today.

czechboy0 commented 9 years ago

Sorry, what is this useful for again? (I'll merge it, I just want to understand the use case first)

drewcrawford commented 9 years ago

CustomStringConvertible is the artist formerly known as Printable. e.g.

let bot : Bot = ...
print("\(bot)") // [Bot MyAwesomeBotName]

as opposed to

let bot : Bot = ...
print("\(bot)") //XcodeServerSDK.Bot

or

let bot : Bot = ...
print("\(bot.description()")

(which, among other problems, conflicts with the Swift/ObjC convention of having a property called description)

czechboy0 commented 9 years ago

Ah that's cool, didn't know that!

czechboy0 commented 9 years ago

Thanks @drewcrawford!