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

Expressing trait type restrictions via protocol? #7

Open
antonselyanin opened this issue Feb 4, 2017 · 4 comments
Open

Expressing trait type restrictions via protocol? #7

antonselyanin opened this issue Feb 4, 2017 · 4 comments

Comments

@antonselyanin
Copy link

As I understand, if I want Font trait to support UITextView I have to modify Font source code: add UITextView.self to restrictedTypes array and modify apply method.

IMO, if target type restrictions were expressed via a protocol, it would be easier to add new target classes to existing traits.

@krzysztofzablocki
Copy link
Owner

example code? Do you mean having something like FontModifiable that would express protocol for modifying them and then conforming as extensions?

@antonselyanin
Copy link
Author

Yes, it would be easier to reuse traits if each trait had such {Trait}Modifiable protocol.

If Font trait had FontModifiable protocol for targets, I could conform UITextView to this protocol and use the trait.

@krzysztofzablocki
Copy link
Owner

thats an idea for a PR, do you want to try contributing it?

@antonselyanin
Copy link
Author

Sure!

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