Open davepatterson opened 8 years ago
First of all, no matter how, it would be a major version update with breaking changes. I tried to keep it minimum though.
Current structure of SwiftValidator is very limitive because it depends on UITextField class. @glaucocustodio's pr is about adding supprt for more classes. For me, it's still limitive. Not only you need to make changes on the library if you want to extend with more classes, it'll also pile up on the variables and function parameters. The more Swift way to do it is using protocols. With my solution, anyone can extend their own classes and make it Validatable. It doesn't even have to be a UIView.
I can keep improving my PR, but I need to know if you intend to merge it or not (I don't want spend my time in vain). Given this is OSS, it is supposed to be improved with time. @davepatterson
@glaucocustodio I understand where you're coming from but I must admit that your PR is a bit clunky and contains a fair amount of replicated source code. I'm going to have to say that I'm siding with @dadalar as his protocol based approach is more Swift-esque. If you have time, I recommend that you check it out #111 😄
@dadalar's approach seems much better. I tried to use protocols, but I failed. I think would be nice if he could write more extensions beyond UITextField
's (extension UITextField: Validatable
).
Definitely. I already have a few extensions. I am going to submit a PR after I merged @dadalar's. I was just waiting for your feedback first @glaucocustodio.
Lets merge it! 🎉
@glaucocustodio and @dadalar,
I understand that both of you have each proposed ways to go about extending this library beyond UITextField. This is definitely something that I'm too interested in. In fact, the only thing that kept me from merging your PR @glaucocustodio was your lack of code coverage. Tonight, I intend to read through your proposal @dadalar. In the meantime, I'm welcome to any comparative analyses of the two PRs either of you care to provide.
Dave