Convert Figma logo to code with AI

TextureGroup logoTexture

Smooth asynchronous user interfaces for iOS apps.

7,995
1,288
7,995
616

Top Related Projects

Smooth asynchronous user interfaces for iOS apps.

13,992

A collection of iOS components.

12,844

A data-driven UICollectionView framework for building fast and flexible lists.

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

19,660

An extensible iOS and OS X animation library, useful for physics-based interactions.

A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Quick Overview

Texture (formerly AsyncDisplayKit) is a powerful iOS framework for smooth and responsive interfaces. It's designed to keep complex user interfaces thread-safe and run asynchronously, resulting in improved performance and responsiveness in iOS applications.

Pros

  • Significantly improves scrolling performance and responsiveness in complex UIs
  • Enables asynchronous and concurrent rendering of UI elements
  • Provides a suite of optimized UI components (ASDisplayNode subclasses)
  • Offers automatic layout and sizing calculations

Cons

  • Steep learning curve for developers new to asynchronous UI programming
  • Requires rethinking traditional UIKit-based app architecture
  • May introduce additional complexity for simpler applications
  • Limited community support compared to UIKit

Code Examples

  1. Creating a basic node:
let node = ASDisplayNode()
node.backgroundColor = .red
node.style.preferredSize = CGSize(width: 100, height: 100)
  1. Implementing a custom node:
class CustomNode: ASDisplayNode {
    override init() {
        super.init()
        automaticallyManagesSubnodes = true
    }
    
    override func layout() {
        super.layout()
        // Custom layout logic here
    }
}
  1. Using ASTableNode instead of UITableView:
class ViewController: ASViewController<ASTableNode> {
    init() {
        let tableNode = ASTableNode(style: .plain)
        super.init(node: tableNode)
        tableNode.dataSource = self
        tableNode.delegate = self
    }
    
    // Implement ASTableDataSource and ASTableDelegate methods
}

Getting Started

To get started with Texture, follow these steps:

  1. Install Texture using CocoaPods by adding the following to your Podfile:

    pod 'Texture'
    
  2. Run pod install in your terminal.

  3. Import Texture in your Swift file:

    import AsyncDisplayKit
    
  4. Start using Texture components by replacing UIKit classes with their ASDisplayNode counterparts (e.g., ASTableNode instead of UITableView).

  5. Implement your UI logic using Texture's asynchronous approach, leveraging features like automatic layout and background rendering.

Competitor Comparisons

Smooth asynchronous user interfaces for iOS apps.

Pros of AsyncDisplayKit

  • Original project with a longer history and more established codebase
  • May have better compatibility with older iOS versions
  • Potentially more stable due to its maturity

Cons of AsyncDisplayKit

  • No longer actively maintained (archived repository)
  • Lacks newer features and optimizations found in Texture
  • May have unresolved bugs or compatibility issues with newer iOS versions

Code Comparison

AsyncDisplayKit:

ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.backgroundColor = [UIColor redColor];
[node setNeedsLayout];
[node layoutIfNeeded];

Texture:

ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.backgroundColor = [UIColor redColor];
[node setNeedsLayout];
[node layoutIfNeeded];

The basic usage and syntax remain largely the same between AsyncDisplayKit and Texture, as Texture is a direct continuation of AsyncDisplayKit. The main differences lie in the underlying implementations, optimizations, and additional features provided by Texture.

Texture builds upon AsyncDisplayKit's foundation, offering improved performance, bug fixes, and new capabilities while maintaining a similar API. Users familiar with AsyncDisplayKit can generally transition to Texture with minimal code changes, benefiting from ongoing development and community support.

13,992

A collection of iOS components.

Pros of YYKit

  • Broader scope, offering a comprehensive suite of utilities beyond UI components
  • Lightweight and easy to integrate into existing projects
  • Extensive documentation and examples in Chinese, beneficial for Chinese-speaking developers

Cons of YYKit

  • Less active development and community support compared to Texture
  • Primarily documented in Chinese, which may be a barrier for non-Chinese speakers
  • Not as optimized for performance in complex UI scenarios as Texture

Code Comparison

YYKit example (image loading):

[imageView yy_setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
                     options:YYWebImageOptionProgressive
                  completion:^(UIImage *image, NSURL *url, YYWebImageFromType from, YYWebImageStage stage, NSError *error) {
    // Handle completion
}];

Texture example (image node):

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
imageNode.URL = [NSURL URLWithString:@"http://example.com/image.jpg"];
[imageNode addTarget:self action:@selector(imageNodeTapped:) forControlEvents:ASControlNodeEventTouchUpInside];

Both libraries provide efficient ways to handle image loading and display, but Texture's approach is more declarative and optimized for asynchronous rendering.

12,844

A data-driven UICollectionView framework for building fast and flexible lists.

Pros of IGListKit

  • Simpler API and easier learning curve
  • Better suited for dynamic content and frequent updates
  • More active community and regular updates

Cons of IGListKit

  • Less performant for complex layouts and large datasets
  • Limited built-in UI components compared to Texture
  • Requires more manual work for advanced customizations

Code Comparison

IGListKit:

let adapter = ListAdapter(updater: ListAdapterUpdater(), viewController: self)
adapter.collectionView = collectionView
adapter.dataSource = self

Texture:

let node = ASCollectionNode(collectionViewLayout: UICollectionViewFlowLayout())
node.dataSource = self
node.delegate = self

Key Differences

  • IGListKit focuses on efficient list management and diffing
  • Texture emphasizes asynchronous rendering and complex layouts
  • IGListKit works with existing UICollectionView, while Texture replaces it with ASCollectionNode
  • Texture offers more comprehensive UI components and layout options
  • IGListKit is more suitable for simpler lists with frequent updates, while Texture excels in complex, high-performance UIs

Cocoa framework and Obj-C dynamism bindings for ReactiveSwift.

Pros of ReactiveCocoa

  • Provides a comprehensive reactive programming framework for iOS and macOS
  • Offers a more flexible and composable approach to handling asynchronous events
  • Supports both Swift and Objective-C, allowing for easier integration in existing projects

Cons of ReactiveCocoa

  • Steeper learning curve compared to Texture, especially for developers new to reactive programming
  • Can lead to more complex code structures if not used carefully
  • May have a higher performance overhead in certain scenarios

Code Comparison

ReactiveCocoa:

let searchResults = searchTextField.reactive.continuousTextValues
    .throttle(0.3, on: QueueScheduler.main)
    .flatMap(.latest) { text in
        return API.search(text)
    }

Texture:

let searchNode = ASEditableTextNode()
searchNode.textView.delegate = self

func textViewDidChange(_ textView: UITextView) {
    API.search(textView.text)
}

ReactiveCocoa provides a more declarative approach to handling user input and API calls, while Texture focuses on optimizing UI performance through its node-based architecture. The choice between the two depends on the specific needs of your project, with ReactiveCocoa offering more flexibility in event handling and Texture excelling in UI rendering efficiency.

19,660

An extensible iOS and OS X animation library, useful for physics-based interactions.

Pros of Pop

  • Lightweight and focused on animation, making it easier to integrate into existing projects
  • Provides a more natural, physics-based animation system
  • Supports both iOS and macOS platforms

Cons of Pop

  • Less actively maintained compared to Texture
  • Limited to animation and dynamic behaviors, while Texture offers a broader range of UI components
  • Smaller community and fewer resources available for learning and troubleshooting

Code Comparison

Pop (Animation):

POPSpringAnimation *anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerBounds];
anim.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 400, 400)];
[layer pop_addAnimation:anim forKey:@"size"];

Texture (UI Component):

ASDisplayNode *node = [[ASDisplayNode alloc] init];
node.backgroundColor = [UIColor redColor];
node.style.preferredSize = CGSizeMake(100, 100);
[self.view addSubnode:node];

While Pop focuses on creating smooth animations, Texture provides a more comprehensive framework for building efficient user interfaces. Pop is ideal for projects requiring advanced animations, whereas Texture is better suited for complex UI layouts and performance optimization.

A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Pros of AFNetworking

  • Simpler and more focused on networking tasks
  • Easier to integrate for basic HTTP requests
  • More lightweight and less resource-intensive

Cons of AFNetworking

  • Limited to networking functionality
  • Less suitable for complex UI-driven applications
  • Lacks advanced UI optimization features

Code Comparison

AFNetworking:

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
[manager GET:@"https://api.example.com/data" parameters:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
    NSLog(@"JSON: %@", responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
    NSLog(@"Error: %@", error);
}];

Texture:

ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
imageNode.URL = [NSURL URLWithString:@"https://example.com/image.jpg"];
[self.view addSubnode:imageNode];

Summary

AFNetworking is a networking library focused on simplifying HTTP requests and responses. It's lightweight and easy to integrate for basic networking tasks. Texture, on the other hand, is a comprehensive UI framework that includes networking capabilities but primarily focuses on optimizing UI performance and responsiveness. While AFNetworking is more suitable for projects that mainly require networking functionality, Texture is better for complex, UI-driven applications that need high performance and smooth scrolling. The code comparison shows AFNetworking's focus on network requests, while Texture's example demonstrates its integration of networking with UI components.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Coming from AsyncDisplayKit? Learn more here

Texture

Apps Using Downloads

Platform Languages

Version Carthage compatible License

Installation

Texture is available via CocoaPods or Carthage. See our Installation guide for instructions.

Performance Gains

Texture's basic unit is the node. An 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.

Texture lets you move image decoding, text sizing and rendering, layout, and other expensive UI operations off the main thread, to keep the main thread available to respond to user interaction.

Advanced Developer Features

As the framework has grown, many features have been added that can save developers tons of time by eliminating common boilerplate style structures common in modern iOS apps. If you've ever dealt with cell reuse bugs, tried to performantly preload data for a page or scroll style interface or even just tried to keep your app from dropping too many frames you can benefit from integrating Texture.

Learn More

Getting Help

We use Slack for real-time debugging, community updates, and general talk about Texture. Signup yourself or email textureframework@gmail.com to get an invite.

Release process

For the release process see the RELEASE file.

Contributing

We welcome any contributions. See the CONTRIBUTING file for how to get involved.

License

The Texture project is available for free use, as described by the LICENSE (Apache 2.0).