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

replace children sugar #232

Open
twerth opened this issue Mar 29, 2015 · 2 comments
Open

replace children sugar #232

twerth opened this issue Mar 29, 2015 · 2 comments

Comments

@twerth
Copy link
Member

twerth commented Mar 29, 2015

Jamon and I discussed this new feature, you can do this now with rmq, but this is symantically very nice:

    rmq(@my_view).replace_children do |view_q|
      @emails.each |email|
        view_q.append(UILabel, :email_address).data(email.url)
      end

      view_q.size_to_fit
    end

replace_children will simply remove all children, then return rmq(@my_view), which can be used with Jamon's new do syntax. So really replace children is just a nicer way to do rmq(@my_view).children.remove.back (assuming that works with remove).

What do you fellow contributors think?

@jamonholmgren
Copy link
Member

This will help with some of the semantics in discussion over on RedPotion. infinitered/redpotion#63

@squidpunch
Copy link
Contributor

we have a few places that we replace all the views when something happens (like a user enters their weight, and we want to remove an empty state and show a current state, I could see this being a bit cleaner with something like this in place.

In my case its messy either way, I think - but this might be less messy :)

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

No branches or pull requests

3 participants