tombenner / nui

Style iOS apps with a stylesheet, similar to CSS
MIT License
3.76k stars 460 forks source link

NUI renderer inheritance #46

Open happycodelucky opened 11 years ago

happycodelucky commented 11 years ago

Tom, is there any reason why the NUI renderer class don't use inheritance? If they did then it would allow for reuse of style properties. For instance bulking up support in NUIViewRenderer could then add support for many UI components if they derived NUIViewRenderer. I mean, why not allow label backgrounds to have gradients, rounded corners, shadows, ...?

tombenner commented 11 years ago

I had been thinking about this a while back; the issue is that the implementation of a given property varies greatly among different UIKit classes. We could add a lot of coverage for properties in NUIViewRenderer, but almost all of them wouldn't be usable in subclasses, or at least there would be better ways to implement them in subclasses.

That said, I haven't sat down and tried to switch over to this setup, so it's very possible that I could be overlooking something. I'm always for DRYing up code, so if you or anyone else wants to try doing this and are able to simplify things with it, definitely let me know!

happycodelucky commented 11 years ago

Thanks Tom, I only toyed with the refactoring a little and haven't sat down to see any potential. I'll take a look and see if there is something we can do here, or something a little different to share common implementation of styles. If I come up with anything I'll let you know.

tombenner commented 11 years ago

Great, thanks!

gastonmorixe commented 9 years ago

This would be great, any update on this? We'd be able say define a class for UIButton and then just modify the background color for some of them, it'd be awesome! extremely flexible.

happycodelucky commented 9 years ago

@imton Sorry, I actually lost track of this a while ago. I ended up using Pixate for a while, and then we decided back before Pixate was officially released it wasn't performant enough. That cause me to look at implementing our own succinct style engine.

gastonmorixe commented 9 years ago

@pryomoax oh! any plans to open source it? :)