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?

Answered by jawbroken in 65204022

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.

Accepted Answer

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?

Mirror for static members?
 
 
Q