infinitered / infinitered/rmq

replace children sugar

Open
#232 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
HTML
Stars
305
Forks
51
PR merge metrics
No merged PRs in 30d

Description

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

``` ruby
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?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start from the rmq(@my_view) entry point and inspect the existing children.remove.back behavior mentioned in the issue. Implement the proposed replace_children behavior around that existing chain, preserving the block/do syntax, and verify that children are removed and the view queue remains usable for appending new views.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
mobile-dev
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.