Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate on a way to order styles #10

Open
werediver opened this issue Sep 30, 2018 · 2 comments
Open

Investigate on a way to order styles #10

werediver opened this issue Sep 30, 2018 · 2 comments

Comments

@werediver
Copy link
Owner

werediver commented Sep 30, 2018

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).

@cfilipov
Copy link

cfilipov commented Oct 1, 2018

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.

@werediver
Copy link
Owner Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants