About YYAsyncLayer

YYAsyncLayer is a flexible and efficient alternative to Core Animation’s CALayer for drawing asynchronously. It provides a smooth rendering experience, especially when dealing with complex graphics or large amounts of data. This library leverages advanced techniques such as texture uploading, multithreading, and double-buffering to achieve high performance.

Key Features

  • Optimal performance for complex graphics and large data sets
  • Asynchronous rendering for a smoother user experience
  • Advanced rendering techniques such as texture uploading and double-buffering
  • Compatible with Core Animation
  • Easy integration into existing projects
  • Highly configurable and customizable


To install YYAsyncLayer, follow these steps:

  1. Add the following line to your Podfile:

pod ‘YYAsyncLayer’

  1. Run the command: pod install
  2. Open your project in Xcode
  3. Import the library into your code using:
    #import <YYAsyncLayer/YYAsyncLayer.h>


To use YYAsyncLayer, follow these steps:

  1. Create a subclass of YYAsyncLayer:

@interface MyCustomAsyncLayer : YYAsyncLayer

@implementation MyCustomAsyncLayer

– (void)displayTask:(YYAsyncLayerDisplayTask *)task {
// Your custom drawing code here…


  1. Create an instance of your custom layer and add it to your view:

MyCustomAsyncLayer *customLayer = [[MyCustomAsyncLayer alloc] init];
customLayer.frame = self.view.bounds;
[self.view.layer addSublayer:customLayer];


YYAsyncLayer provides various customization options. Here are a few examples:

  • Change the drawing block:

MyCustomAsyncLayer *customLayer = [[MyCustomAsyncLayer alloc] init];
customLayer.displayBlock = ^(CGContextRef context, CGSize size, BOOL(^isCancelled)(void)) {
// Your custom drawing code here…

  • Configure layer properties:

customLayer.contentsScale = [UIScreen mainScreen].scale;
customLayer.opaque = YES;

Additional Documentation

For more detailed information on YYAsyncLayer, please refer to the official documentation:

YYAsyncLayer Documentation

Additional notes or any other relevant information can be added here.