--- title: Getting Started layout: docs permalink: /docs/getting-started.html next: intelligent-preloading.html --- AsyncDisplayKit's basic unit is the `node`. ASDisplayNode is an abstraction over UIView, which in turn is an abstraction over CALayer. Unlike views, which can only be used on the main thread, nodes are thread-safe: you can instantiate and configure entire hierarchies of them in parallel on background threads. To keep its user interface smooth and responsive, your app should render at 60 frames per second — the gold standard on iOS. This means the main thread has one-sixtieth of a second to push each frame. That's 16 milliseconds to execute all layout and drawing code! And because of system overhead, your code usually has less than ten milliseconds to run before it causes a frame drop. AsyncDisplayKit lets you move image decoding, text sizing and rendering, and other expensive UI operations off the main thread. It has other tricks up its sleeve too... but we'll get to that later. :]

Nodes

If you're used to working with views, you already know how to use nodes. Most methods have a node equivalent and most UIView and CALayer properties are available as well. In any case where there is a naming discrepancy (such as .clipsToBounds vs .masksToBounds), nodes will default to the UIView name. The only exception is that nodes use position instead of center. Of course, you can always access the underlying view or layer directly via node.view or node.layer. Some of AsyncDisplayKit's core nodes include:

Node Containers

When converting an app to use AsyncDisplayKit, a common mistake is to add nodes directly to an existing view hierarchy. Doing this will virtually guarantee that your nodes will flash as they are rendered. Instead, you should add nodes as subnodes of one of the container classes. These classes are in charge of telling contained nodes what state they're currently in so that data can be loaded and nodes can be rendered as efficiently as possible. You should think of these classes as the integration point between UIKit and ASDK. The four node containers are:

Layout Engine

AsyncDisplayKit's layout engine is both one of its most powerful and one of its most unique features. Based on the CSS FlexBox model, it provides a declarative way of specifying a custom node's size and layout of its subnodes. While all nodes are concurrently rendered by default, asynchronous measurement and layout are performed by providing an ASLayoutSpec for each node. The layout engine is based on the idea of ASLayouts which contain a position and size and ASLayoutSpecs which define various layouts conceptually and are used to output a calculated ASLayout. Layout specs can be composed of both child nodes as well as other layout specs which A few layout specs: