ASVisibiliity

This commit is contained in:
Hannah Trosi
2016-08-22 01:10:37 -07:00
parent 839242f166
commit 7c5e9a2860
5 changed files with 19 additions and 5 deletions

View File

@@ -58,6 +58,7 @@
- debug-tool-ASRangeController
- title: Advanced Technologies
items:
- asvisibility
- asenvironment
- asrunloopqueue

View File

@@ -2,11 +2,11 @@
title: ASEnvironment
layout: docs
permalink: /docs/asenvironment.html
prevPage: debug-tool-ASRangeController.html
prevPage: asvisibility.html
nextPage: asrunloopqueue.html
---
`ASEnvironment` is an optimized state propagation system that allows the framework to distrubute a variety of important "evironmental" information up and down the node hierarchy.
`ASEnvironment` is a performant and scalable way to enable upward and downward propagation of information throughout the node hierarchy. It stores a variety of critical “environmental” metadata, like the trait collection, interface state, hierarchy state, and more.
Any object that conforms to the `<ASEnvironment>` protocol can propagate specific states defined in an `ASEnvironmentState` up and/or down the ASEnvironment tree. To define how merges of States should happen, specific merge functions can be provided.
@@ -16,4 +16,4 @@ This means that whenever a node needs to query something about its environment,
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 no public API available at this time.**
ASEnvironment powers many of the most valuable features of AsyncDisplayKit. **There is no public API available at this time.**

13
_docs/asvisibility.md Executable file
View File

@@ -0,0 +1,13 @@
---
title: ASVisibility
layout: docs
permalink: /docs/asvisibility.html
prevPage: debug-tool-ASRangeController.html
nextPage: asenvironment.html
---
`ASNavigationController` and `ASTabBarController` both implement the `ASVisibility` protocol. These classes can be used even without `ASDisplayNodes`, making them suitable base classes for your inheritance hierarchy. For any child view controllers that are `ASViewControllers`, these classes know the exact number of user taps it would take to make the view controller visible (0 if currently visible).
Knowing a view controllers visibility depth allows view controllers to automatically take appropriate actions as a user approaches or leaves them. Non-default tabs in an app might preload some of their data; a controller 3 levels deep in a navigation stack might progressively free memory for images, text, and fetched data as it gets deeper.
Any container view controller can implement a simple protocol to integrate with the system. For example, `ASNavigationController` will return a visibility depth of it's own visibilityDepth + 1 for a view controller that would be revealed by tapping the back button once.

View File

@@ -8,7 +8,7 @@ nextPage: containers-astablenode.html
`ASViewController` is a subclass of `UIViewController` that adds several useful features for hosting `ASDisplayNode` hierarchies.
An ASViewController can be used in place of any UIViewController - including within a UINavigationController, UITabBarController and UISpitViewController or as a modal view controller.
An ASViewController can be used in place of any UIViewController - including within a `UINavigationController`, `UITabBarController` and `UISpitViewController` or as a modal view controller.
One of the main benefits to using an ASViewController is to save memory. An ASViewController that goes off screen will automatically reduce the size of the fetch data and display ranges of any of its children. This is key for memory management in large applications.

View File

@@ -3,7 +3,7 @@ title: Range Visualization
layout: docs
permalink: /docs/debug-tool-ASRangeController.html
prevPage: debug-tool-pixel-scaling.html
nextPage: asenvironment.html
nextPage: asvisibility.html
---
##Visualize ASRangeController tuning parameters <a href="https://github.com/facebook/AsyncDisplayKit/pull/1390">(PR #1390)</a>