Class
ADAssetListDataSource
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.
Relationships
Conforms To
NSObject
PHPhotoLibraryChangeObserver
Initializers
init(reloadable:album:selects:albumOpts:assetOpts:)
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
Name | Type | Description |
---|---|---|
reloadable | ADDataSourceReloadable |
Associate reloadable view. |
album | ADAlbumModel |
Album to get assets. |
selects | [PHAsset] |
Selected assets. |
albumOpts | ADAlbumSelectOptions |
Options to limit album type and order. It is |
assetOpts | ADAssetSelectOptions |
Options to control the asset select condition and ui. It is |
init(reloadable:album:selects:albumOpts:assetOpts:)
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
Name | Type | Description |
---|---|---|
reloadable | ADDataSourceReloadable |
Associate reloadable view. |
album | ADAlbumModel |
Album to get assets. |
selects | [ADSelectAssetModel] |
Selected asset models. |
albumOpts | ADAlbumSelectOptions |
Options to limit album type and order. It is |
assetOpts | ADAssetSelectOptions |
Options to control the asset select condition and ui. It is |
Properties
reloadable
public weak var reloadable: ADDataSourceReloadable?
The associate reloadable view conform to ADDataSourceReloadable
.
assetOpts
public let assetOpts: ADAssetSelectOptions
Options to control the asset select condition and ui.
enableCameraCell
public var enableCameraCell: Bool
Indicate whether show camera cell in CameraRoll. if true
, camera roll page will show camera cell.
enableAddAssetCell
@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.
selectAssetChanged
public var selectAssetChanged: ((Int)->Void)?
Called when select asset or deselect asset.
Methods
reloadData(completion:)
public func reloadData(completion: (() -> Void)? = nil)
Reload the associate view with fetch assets.
Parameters
Name | Type | Description |
---|---|---|
completion | (() -> Void)? |
Called when the reload finished. |
modifyIndexPath(_:)
public func modifyIndexPath(_ indexPath: IndexPath) -> IndexPath
Return modify indexPath when camera cell or add asset cell is enable.
Parameters
Name | Type | Description |
---|---|---|
indexPath | IndexPath |
Orginal indexPath. |
Returns
Modify indexPath.
selectAssetAt(index:)
public func selectAssetAt(index: Int)
Select the asset.
Parameters
Name | Type | Description |
---|---|---|
index | Int |
Index whitch asset is select. |
deselectAssetAt(index:)
public func deselectAssetAt(index: Int)
Deselect the asset.
Parameters
Name | Type | Description |
---|---|---|
index | Int |
Index whitch asset is deselect. |
reloadSelectAssetIndexs(_:current:)
public func reloadSelectAssetIndexs(_ indexs: [Int], current: Int)
Reload asset selectStatus
with select indexs. Use this method when return from browser controller.
Parameters
Name | Type | Description |
---|---|---|
indexs | [Int] |
Select asset indexs. |
current | Int |
Current browser index. |
photoLibraryDidChange(_:)
public func photoLibraryDidChange(_ changeInstance: PHChange)