В Objective-C к их классу можно добавить метод description, чтобы помочь в отладке:
@implementation MyClass
- (NSString *)description
{
    return [NSString stringWithFormat:@"<%@: %p, foo = %@>", [self class], foo _foo];
}
@end
Затем в отладчике вы можете сделать:
po fooClass
<MyClass: 0x12938004, foo = "bar">
Что такое эквивалент в Swift? Может оказаться полезным выход Swift REPL:
  1> class MyClass { let foo = 42 }
  2> 
  3> let x = MyClass()
x: MyClass = {
  foo = 42
}
Но я хотел бы переопределить это поведение для печати на консоли:
  4> println("x = \(x)")
x = C11lldb_expr_07MyClass (has 1 child)
Есть ли способ очистить этот вывод println? Я видел протокол Printable:
/// This protocol should be adopted by types that wish to customize their
/// textual representation.  This textual representation is used when objects
/// are written to an `OutputStream`.
protocol Printable {
    var description: String { get }
}
Я решил, что это будет автоматически "видно" на println, но это не так:
  1> class MyClass: Printable {
  2.     let foo = 42
  3.     var description: String { get { return "MyClass, foo = \(foo)" } }
  4. }   
  5> 
  6> let x = MyClass()
x: MyClass = {
  foo = 42
}
  7> println("x = \(x)")
x = C11lldb_expr_07MyClass (has 1 child)
И вместо этого я должен явно вызвать описание:
 8> println("x = \(x.description)")
x = MyClass, foo = 42
Есть ли лучший способ?
