wangshengjia / LeeGo

Declarative, configurable & highly reusable UI development as making Lego bricks.
MIT License
966 stars 45 forks source link

Component Action #62

Open freesuraj opened 8 years ago

freesuraj commented 8 years ago

Hi Wang,

Congrats on the great tool, nicely done !! I was wondering what's your plan for providing actions for components, like Button, swipe, tap, or anything? Blockable actions?

wangshengjia commented 8 years ago

Thanks a lot for the kind words, really glad to hear. 😀

For the moment, LeeGo support such kind of Action as IB files. Which means you can find and link the instance of component directly with lg_viewForOutletKey method, just as IBOutlet do.

// Retrieve target view from hierarchy based on a configured key in `Brick`, 
// then either manipulate object directly or keep it into a class property with 
// weak reference, just as `IBOutlet`
let likeButton = tweetView.lg_viewForOutletKey("likeButton")
likeButton.addTarget(...)

Since this approach let people manipulate directly instance which could introduce easily more mutable states and complexity, which isn't encouraged by LeeGo's philosophy, so we may use declarative blockable actions to replace it in the future release.

What you think?

freesuraj commented 8 years ago

Exactly. I would think declarative blocks should be the way to go. I and my colleague would be happy to contribute some as we love the work and the concept you've done so far. I believe we could make this one of the best componentKit out there.

Sent from my iPhone

On 2 Jun 2016, at 6:52 PM, WANG Shengjia notifications@github.com wrote:

Thanks a lot for the kind words, really glad to hear. 😀

For the moment, LeeGo support such kind of Action as IB files. Which means you can find and link the instance of component directly with lg_viewForOutletKey method, just as IBOutlet do.

// Retrieve target view from hierarchy based on a configured key in Brick, // then either manipulate object directly or keep it into a class property with // weak reference, just as IBOutlet let likeButton = tweetView.lg_viewForOutletKey("likeButton") likeButton.addTarget(...) Since this approach let people manipulate directly instance which could introduce easily more mutable states and complexity, which isn't encouraged by LeeGo's philosophy, so we may use declarative blockable actions to replace it in the future release.

What you think?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

wangshengjia commented 8 years ago

Yeah, totally cool. It would be great if you'd like to contribute, PR is always welcomed. 👍