CustomStringConvertible protocol

3 Просмотры
Издатель
Did you know what the CustomStringConvertible protocol is used for in Swift programming?
Well...
if you have a struct, enum, or class that you often print out for debugging purposes, conforming to CustomStringConvertible to provide a custom string description can save you a lot of time and hassle. Instead of manually typing out each property you want to print, you can just print the object, and Swift will use your custom description.
Thanks for watching.

Music: Driving in the rain by Timecrawler 82 (Free Music Archive, CC BY)
Категория
Язык программирования Swift
Комментариев нет.