ASMultiplexImageNodeDataSource Protocol Reference

Conforms to NSObject
Declared in ASMultiplexImageNode.h

Overview

The ASMultiplexImageNodeDataSource protocol is adopted by an object that provides the multiplex image node, for each image identifier, an image or a URL the image node should load.

– multiplexImageNode:imageForImageIdentifier:

An image for the specified identifier.

- (nullable UIImage *)multiplexImageNode:(ASMultiplexImageNode *)imageNode imageForImageIdentifier:(ASImageIdentifier)imageIdentifier

Parameters

imageNode

The sender.

imageIdentifier

The identifier for the image that should be returned.

Return Value

A UIImage corresponding to imageIdentifier, or nil if none is available.

Discussion

If the image is already available to the data source, this method should be used in lieu of providing the URL to the image via -multiplexImageNode:URLForImageIdentifier:.

Declared In

ASMultiplexImageNode.h

– multiplexImageNode:URLForImageIdentifier:

An image URL for the specified identifier.

- (nullable NSURL *)multiplexImageNode:(ASMultiplexImageNode *)imageNode URLForImageIdentifier:(ASImageIdentifier)imageIdentifier

Parameters

imageNode

The sender.

imageIdentifier

The identifier for the image that will be downloaded.

Return Value

An NSURL for the image identified by imageIdentifier, or nil if none is available.

Discussion

Supported URLs include HTTP, HTTPS, AssetsLibrary, and FTP URLs as well as Photos framework URLs (see note).

If the image is already available to the data source, it should be provided via [ASMultiplexImageNodeDataSource multiplexImageNode:imageForImageIdentifier:] instead.

See Also

  • [NSURL URLWithAssetLocalIdentifier:targetSize:contentMode:options:] below.

Declared In

ASMultiplexImageNode.h

– multiplexImageNode:assetForLocalIdentifier:

A PHAsset for the specific asset local identifier

- (nullable PHAsset *)multiplexImageNode:(ASMultiplexImageNode *)imageNode assetForLocalIdentifier:(NSString *)assetLocalIdentifier

Parameters

imageNode

The sender.

assetLocalIdentifier

The local identifier for a PHAsset that this image node is loading.

Return Value

A PHAsset corresponding to assetLocalIdentifier, or nil if none is available.

Discussion

This optional method can improve image performance if your data source already has the PHAsset available. If this method is not implemented, or returns nil, the image node will request the asset from the Photos framework.

Note: This method may be called from any thread.

Declared In

ASMultiplexImageNode.h