Kingfisher Documentation

Structure AVAsset​Image​Data​Provider

public struct AVAssetImageDataProvider: ImageDataProvider  

A data provider to provide thumbnail data from a given AVKit asset.

%281 AVAssetImageDataProvider AVAssetImageDataProvider ImageDataProvider ImageDataProvider AVAssetImageDataProvider->ImageDataProvider

Nested Types

AVAssetImageDataProvider.AVAssetImageDataProviderError

The possible error might be caused by the AVAssetImageDataProvider.

Conforms To

ImageDataProvider

Represents a data provider to provide image data to Kingfisher when setting with Source.provider source. Compared to Source.network member, it gives a chance to load some image data in your own way, as long as you can provide the data representation for the image.

Initializers

init(asset​Image​Generator:​time:​)

public init(assetImageGenerator: AVAssetImageGenerator, time: CMTime)  

Creates an asset image data provider.

Parameters

asset​Image​Generator AVAsset​Image​Generator

The asset image generator controls data providing behaviors.

time CMTime

At which time in the asset the image should be generated.

init(asset​URL:​time:​)

public init(assetURL: URL, time: CMTime)  

Creates an asset image data provider.

This method uses assetURL to create an AVAssetImageGenerator object and calls the init(assetImageGenerator:time:) initializer.

Parameters

asset​URL URL

The URL of asset for providing image data.

time CMTime

At which time in the asset the image should be generated.

init(asset​URL:​seconds:​)

public init(assetURL: URL, seconds: TimeInterval)  

Creates an asset image data provider.

This method uses assetURL to create an AVAssetImageGenerator object, uses seconds to create a CMTime, and calls the init(assetImageGenerator:time:) initializer.

Parameters

asset​URL URL

The URL of asset for providing image data.

seconds Time​Interval

At which time in seconds in the asset the image should be generated.

Properties

asset​Image​Generator

public let assetImageGenerator: AVAssetImageGenerator

The asset image generator bound to self.

time

public let time: CMTime

The time at which the image should be generate in the asset.

cache​Key

public var cacheKey: String  

The cache key used by self.

Methods

data(handler:​)

public func data(handler: @escaping (Result<Data, Error>) -> Void)