Files
Texture/Source/ASDefaultImageDownloader.h
T
Andy Finnell e696302586 Add default image provider (#2127)
* Add default image provider

## Summary

Right now image nodes hardcode logic to use either PINRemoteImage or the basic image downloader. Additionally, Texture is missing annotations for nullability and sendable for several of the image blocks and types.

Introduce ASDefaultImageDownloader as a singleton. It takes blocks to return the default image downloader and image cache. Update both image nodes to use this. By default ASDefaultImageDownloader uses the same logic the image nodes used to, so change in behavior.

## Test plan

Run the Kittens example and verify it works.

* Appears we need Xcode 16.4

* And need at least 18.5
2025-10-22 12:36:55 -04:00

28 lines
774 B
Objective-C

//
// ASDefaultImageDownloader.h
// Texture
//
// Created by Andrew Finnell on 5/14/25.
// Copyright © 2025 Pinterest. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASImageProtocols.h>
NS_ASSUME_NONNULL_BEGIN
typedef id<ASImageDownloaderProtocol>_Nullable(^ASImageDownloaderProvider)(void);
typedef id<ASImageCacheProtocol>_Nullable(^ASImageCacheProvider)(void);
@interface ASDefaultImageDownloader : NSObject
+ (nullable id<ASImageDownloaderProtocol>)defaultDownloader;
+ (nullable id<ASImageCacheProtocol>)defaultCache;
+ (void)setDefaultDownloaderProvider:(ASImageDownloaderProvider _Nonnull)downloaderProvider
cacheProvider:(ASImageCacheProvider _Nonnull)cacheProvider;
@end
NS_ASSUME_NONNULL_END