ADPhotoKit Documentation

Class ADAsset​List​Data​Source

public class ADAssetListDataSource: NSObject  

The data source of asset model controller. It get assets you request and reload the associate reloadable view when assets changed.

%19 ADAssetListDataSource ADAssetListDataSource NSObject NSObject ADAssetListDataSource->NSObject PHPhotoLibraryChangeObserver PHPhotoLibraryChangeObserver ADAssetListDataSource->PHPhotoLibraryChangeObserver

Conforms To

NSObject
PHPhotoLibraryChangeObserver

Initializers

init(reloadable:​album:​selects:​album​Opts:​asset​Opts:​)

public init(reloadable: ADDataSourceReloadable,
                album: ADAlbumModel,
                selects: [PHAsset],
                albumOpts: ADAlbumSelectOptions,
                assetOpts: ADAssetSelectOptions)  

Create data source with associate reloadable view, album model, select assets and options.

Parameters

reloadable ADData​Source​Reloadable

Associate reloadable view.

album ADAlbum​Model

Album to get assets.

selects [PHAsset]

Selected assets.

album​Opts ADAlbum​Select​Options

Options to limit album type and order. It is ADAlbumSelectOptions.default by default.

asset​Opts ADAsset​Select​Options

Options to control the asset select condition and ui. It is ADAssetSelectOptions.default by default.

init(reloadable:​album:​selects:​album​Opts:​asset​Opts:​)

public init(reloadable: ADDataSourceReloadable,
                album: ADAlbumModel,
                selects: [ADSelectAssetModel],
                albumOpts: ADAlbumSelectOptions,
                assetOpts: ADAssetSelectOptions)  

Create data source with associate reloadable view, album model, select assets and options.

Parameters

reloadable ADData​Source​Reloadable

Associate reloadable view.

album ADAlbum​Model

Album to get assets.

selects [ADSelect​Asset​Model]

Selected asset models.

album​Opts ADAlbum​Select​Options

Options to limit album type and order. It is ADAlbumSelectOptions.default by default.

asset​Opts ADAsset​Select​Options

Options to control the asset select condition and ui. It is ADAssetSelectOptions.default by default.

Properties

reloadable

public weak var reloadable: ADDataSourceReloadable? 

The associate reloadable view conform to ADDataSourceReloadable.

album​Opts

public let albumOpts: ADAlbumSelectOptions

Options to set the album type and order.

asset​Opts

public let assetOpts: ADAssetSelectOptions

Options to control the asset select condition and ui.

album

public let album: ADAlbumModel

The album select to get assets.

list

public var list: [ADAssetModel] = [] 

Assets array request from album.

selects

public var selects: [ADSelectAssetModel] = [] 

Assets you select.

append​Cell​Count

public var appendCellCount: Int  

The cell count except assets.

enable​Camera​Cell

public var enableCameraCell: Bool  

Indicate whether show camera cell in CameraRoll. if true, camera roll page will show camera cell.

camera​Cell​Index

public var cameraCellIndex: Int  

The index for camera cell.

enable​Add​Asset​Cell

@available(iOS 14, *)
    public var enableAddAssetCell: Bool  

Indicate whether show add asset in CameraRoll when user choose limited Photo mode. if true, camera roll page will show add asset cell.

add​Asset​Cell​Index

public var addAssetCellIndex: Int  

The index for add seest cell.

select​Asset​Changed

public var selectAssetChanged: ((Int)->Void)? 

Called when select asset or deselect asset.

Methods

reload​Data(completion:​)

public func reloadData(completion: (() -> Void)? = nil)  

Reload the associate view with fetch assets.

Parameters

completion (() -> Void)?

Called when the reload finished.

modify​Index​Path(_:​)

public func modifyIndexPath(_ indexPath: IndexPath) -> IndexPath  

Return modify indexPath when camera cell or add asset cell is enable.

Parameters

index​Path Index​Path

Orginal indexPath.

Returns

Modify indexPath.

select​Asset​At(index:​)

public func selectAssetAt(index: Int)  

Select the asset.

Parameters

index Int

Index whitch asset is select.

deselect​Asset​At(index:​)

public func deselectAssetAt(index: Int)  

Deselect the asset.

Parameters

index Int

Index whitch asset is deselect.

reload​Select​Asset​Indexs(_:​current:​)

public func reloadSelectAssetIndexs(_ indexs: [Int], current: Int)  

Reload asset selectStatus with select indexs. Use this method when return from browser controller.

Parameters

indexs [Int]

Select asset indexs.

current Int

Current browser index.

photo​Library​Did​Change(_:​)

public func photoLibraryDidChange(_ changeInstance: PHChange)