Custom Reflectable


(Dylan Wreggelsworth) #1

Greetings all,
I'd like to put together an extension for CGVector that allows it to be
seen much like CGPoint i.e.: { dx: 1.0, dy: 1.0 } instead of { x: 1.0, y:
1.0 }. However, when I use:

// This seems broken, ```.`struct```` doesn't work at all...
extension CGVector: CustomReflectable {
    public var customMirror: Mirror {
        return Mirror(self, children: ["dx": dx, "dy": dy], displayStyle:
.struct)
    }
}

What I get is " __C.CGVector". Now, If I change displayStyle to .tuple, I
get values formatted like a tuple.

Am I not fully adhering to CustomReflectable? Is this a C bridging issue?
Or is this a flaw?

Thanks!