# Layer Backing

어떤 경우에는 뷰 대신 레이어를 사용함으로써 앱의 성능을 향상시킬 수 있습니다. Texture 에서는 Touch Handling 이 필요 없는 Custom Node 를 **layer-backing** 하도록 권장합니다.

UIKit 은 API 의 차이 때문에 뷰 기반 코드를 레이어로 수동 변환하는건 어렵습니다. 더 심각한건, 터치 핸들링 또는 특정 뷰 기능을 활성화할 때 전부 수동으로 변환해야 합니다.

모든 Texture 노드에서 전체 서브 트리를 뷰에서 레이어로 변환하는 작업은 다음과 같이 간단합니다.

```swift
rootNode.isLayerBacked = true
```

다시 돌리려면 위 한 줄을 지우면 됩니다 :D

![Example.jpg](https://3869498049-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LaEAeqdrDdtqs2agQRO%2F-LcBWxhOEPg9cEplo1VU%2F-LcBX-V66KWYFPTYPyc2%2F%E1%84%89%E1%85%B3%E1%84%8F%E1%85%B3%E1%84%85%E1%85%B5%E1%86%AB%E1%84%89%E1%85%A3%E1%86%BA%202019-04-11%20%E1%84%8B%E1%85%A9%E1%84%92%E1%85%AE%2010.13.03.png?alt=media\&token=4ec15ebc-2d77-4c3e-b0a0-a3444cbeb485)

주의사항으로는 **isLayerBacked가 활성화**된 ASControlNode 및 서브 노드들은 **addTarget:을 사용할 수 없습니다.** (내부적으로 크래시 일어납니다.)

하지만 **p7.11 branch** 또는 **2.9** 이후 부터는 사용가능합니다.

{% embed url="<https://github.com/TextureGroup/Texture/pull/1396>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://texture-kr.gitbook.io/wiki/optimizations/layer-backing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
