Files
AsyncDisplayKit/_docs/layer-backing.md
Hannah Trosi fc88b8ccac website refactoring
clean up optimization docs
rearrange sections in nav bar
add layout api sizing Q to FAQ
add corner rounding to Optimizations + check back soon tags for methods to be released in 2.0
add layoutSpecs
Containers overview -> node containers
Node overview -> node subclasses
remove ASTextCellNode
2016-07-10 22:52:58 -07:00

32 lines
1.2 KiB
Markdown
Executable File

---
title: Layer Backing
layout: docs
permalink: /docs/layer-backing.html
prevPage: placeholder-fade-duration.html
nextPage: subtree-rasterization.html
---
In some cases, you can substantially improve your app's performance by using layers instead of views. We recommend enabling layer-backing as a matter of course in **any custom node that doesn't need touch handling**.
With UIKit, manually converting view-based code to layers is laborious due to the difference in APIs. Worse, if at some point you need to enable touch handling or other view-specific functionality, you have to manually convert everything back (and risk regressions!).
With all AsyncDisplayKit nodes, converting an entire subtree from views to layers is as simple as...
<div class = "highlight-group">
<span class="language-toggle"><a data-lang="swift" class="swiftButton">Swift</a><a data-lang="objective-c" class = "active objcButton">Objective-C</a></span>
<div class = "code">
<pre lang="objc" class="objcCode">
rootNode.layerBacked = YES;
</pre>
<pre lang="swift" class = "swiftCode hidden">
rootNode.layerBacked = true
</pre>
</div>
</div>
<br>
...and if you need to go back, it's as simple as deleting one line.