Mirror for static members?

Consider:


struct TestStruct {
    let a = 3
    static let b = 4
}
let t = TestStruct()
let m = Mirror(reflecting: t)
for c in m.children {
    let label = c.label
    let value = c.value
}


The playground correctly shows "a" and "3".


But what about b?


How can I access the "type members" as opposed to the instance members?

Accepted Reply

Reflection is still half-baked, or less. Presumably this would be

let m = Mirror(reflecting: TestStruct.self)

but that doesn't currently give you a useful mirror.

Replies

Reflection is still half-baked, or less. Presumably this would be

let m = Mirror(reflecting: TestStruct.self)

but that doesn't currently give you a useful mirror.

I'm having the same issue. Was there a solution?

Has anyone figured out a good solution to this?