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

Questions about prune(view) #14

Closed
hfossli opened this issue Jun 1, 2016 · 2 comments
Closed

Questions about prune(view) #14

hfossli opened this issue Jun 1, 2016 · 2 comments

Comments

@hfossli
Copy link
Contributor

hfossli commented Jun 1, 2016

Hey. Nice work!

I have not used your framework yet. I've only read the source as I have another closed source project (closed for now) in objc which also takes great inspiration from react.

About this method:

func prune(view: UIView) {
if !viewSet.contains(view) {
view.removeFromSuperview() //todo: put in a global reusable pool?
} else {
for subview in view.subviews where subview.hasFlexNode {
prune(subview)
}
}
}

A UIScrollView has two UIImageView's as subviews – the scroll indicators. There are many types of views which uses subviews internally. UIButton, UITableView, etc etc. Do you take that into account when reusing views?

In my framework I'm thinking that I might need to have separate rules for reusing and splitting up the different types of views depending on its structure.

@alexdrone
Copy link
Owner

The diff algorithm works with the componentNodes and not with the views.. So the granularity is different. Every node has a view associated (and that can be a complex view hierarchy per se) - the infra won't be touching views that are subviews of the node root view.

@hfossli
Copy link
Contributor Author

hfossli commented Jun 1, 2016

I see. Clever 👌🏼

@hfossli hfossli closed this as completed Jun 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants