Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

New update is not compilable

Open alexs555 opened this issue 9 years ago • 5 comments

Hello! Today I stuck with an issue after swift-2-old branch was dropped. Some Mirror's declaration don't work anymore, Ex:

  1. let itemMirror: Mirror? doesnt compile https://gyazo.com/b5efc0486eaf7db664f5353661c4772b

if let value = itemMirror[param] where value is String { return value as? String } (type Mirror doesn't have subscript members)) https://gyazo.com/9547f3b03852993d1d49b675ad0f3a44

What can be the reason? Thank you.

alexs555 avatar Feb 17 '16 08:02 alexs555

Hi, thanks for reporting issue. Is it possible to actually see the code so I can try to fix it?

1 issue:

The mirror is generic type. Try Mirror<Int>?

2 Issue

Yes the subscript operator was disable for now because of new API in Swift.Mirror reflection API. It should be fixed very soon. I'm sorry for that troubles

kostiakoval avatar Feb 17 '16 08:02 kostiakoval

Take a look at screenshots attached. Is it possible to make an Mirror var as a field in struct?

alexs555 avatar Feb 17 '16 08:02 alexs555

I think it should be possible, don't see any reason why it shouldn't work

kostiakoval avatar Feb 17 '16 11:02 kostiakoval

Is it possible also to return back swift-2-old branch where subscripts worked?

alexs555 avatar Feb 17 '16 11:02 alexs555

I'm sorry but that branch was completely wrong and borken. That's why it was deleted.

Can you please check swift-2.0 branch. The subscript should work there.

kostiakoval avatar Feb 17 '16 11:02 kostiakoval