Update asenvironment.md

This commit is contained in:
Hannah Troisi
2016-07-24 15:52:06 -07:00
committed by GitHub
parent 1b3a16f25b
commit feb89ca673

View File

@@ -12,6 +12,8 @@ Any object that conforms to the `<ASEnvironment>` protocol can propagate specifi
Compared to UIKit, this system is very efficient and one of the reasons why nodes are much lighter weight than UIViews. This is achieved by using simple structures to store data rather than creating objects. For example, `UITraitCollection` is an object, but `ASEnvironmentTraitCollection` is just a struct.
This means that whenever a node needs to query something about its environment, for example to check its [interface state](http://asyncdisplaykit.org/docs/intelligent-preloading.html#interface-state-ranges) or whether it is part of a rasterized hierarchy (whether any parent has .shouldRasterizeDescendents enabled), instead of climbing the entire tree or checking all of its children, it can go to one spot and read the value that was propogated to it.
This means that whenever a node needs to query something about its environment, for example to check its [interface state](http://asyncdisplaykit.org/docs/intelligent-preloading.html#interface-state-ranges), instead of climbing the entire tree or checking all of its children, it can go to one spot and read the value that was propogated to it.
A key operating principle of ASEnvironment is to update values when new subnodes are added or removed.
**ASEnvironment is currently used internally in the framework.** There is currently no public API available.