4

I thought the Printable protocol would do it, but it doesn't. Is there another protocol? I want it to show the 3 numbers, not "C._GLKVector3"

enter image description here

Rob N
  • 15,024
  • 17
  • 92
  • 165

2 Answers2

2

As of Swift 2 this can be done by making the type conform to CustomStringConvertible (previously Printable). In the case of GLKVector3 you would do:

extension GLKVector3: CustomStringConvertible {
    public var description: String {
        return "<\(x), \(y), \(z)>"
    }
}

enter image description here

ABakerSmith
  • 22,759
  • 9
  • 68
  • 78
0

Try import XCPlayground there is something for that. Here is everything from that modul: https://developer.apple.com/library/mac/documentation/Swift/Reference/Playground_Ref/Chapters/XCPlayground.html

Jan Kaifer
  • 664
  • 4
  • 18