Swift Text Output Streams
This code doesn’t look too bad, but it’s a pain to write
var description = ""andreturn descriptionover and over, if this is a pattern you commonly use. It’s also quite easy to forget to add\nto each line.The relatively unknown standard library protocol
TextOutputStreamablesolves both of these problems for you. Rather than adding adescriptioncomputed property, all you have to do is write your properties to aTextOutputStreaminstance[…]