Open werediver opened 6 years ago
One way, as mentioned in #6, is so constrain the target and the marker (protocol) to being objective c objects so that objc runtime methods can be used to introspect those types. Wondering what your opinion on this is. Unfortunately I was not able to find a way to do this in pure swift, even with Mirror
.
I have also took a look at the Mirror API. The conclusion is same as yours: it doesn't show the superclass without an instance.
I don't like the idea to leverage the Objective-C runtime for this work. I'd rather wait till Swift Mirror API is developed enough to support this use case.
As an alternative, we can think of a way to diagnose wrong style ordering in run-time.
The current implementation applies the styles in the order of definition. This is prone to errors (e.g. a style for a base class can override a style for a subclass, if the former is defined after the latter).
Investigate on a clean and reliable way to order styles depending on the subtype relationships of their targets and markers.
If a clean and reliable way to order styles is found, plan transition to a flat style list instead of the current tree-like structure (in a separate ticket).