ADPhotoKit Documentation

Class ADAsset​Browser​Data​Source

public class ADAssetBrowserDataSource: NSObject  

The data source of browser controller. It reload the associate reloadable view when selet or deselect asset, browser index change, select order change.

%189 ADAssetBrowserDataSource ADAssetBrowserDataSource NSObject NSObject ADAssetBrowserDataSource->NSObject

Conforms To

NSObject

Initializers

init(options:​list:​selects:​index:​)

public init(options: ADAssetBrowserOptions,
                list: [ADAssetBrowsable],
                selects: [ADAssetBrowsable],
                index: Int?)  

Create data source with browser data, options and select info.

Parameters

options ADAsset​Browser​Options

Options to control browser controller. It is ADAssetBrowserOptions.default by default.

list [ADAsset​Browsable]

Asset array to browser.

selects [ADAsset​Browsable]

Assets have been selected.

index Int?

Default asset index in list. If nil, it will be set first select asset index in list or set 0 when select count is 0.

Properties

list​View

public weak var listView: UICollectionView? 

Associate browser view.

select​View

public weak var selectView: UICollectionView? 

Associate select preview view.

options

public let options: ADAssetBrowserOptions

Options to control the asset browser condition and ui.

list

public var list: [ADAssetBrowsable] 

Assets to browser.

selects

public var selects: [ADAssetBrowsable] = [] 

Select assets.

select​Indexs

public var selectIndexs: [Int?] = [] 

Select asset's index.

current

public var current: ADAssetBrowsable?  

Current browser asset. Will be nil if select asset is not in list.

index

@objc
    public dynamic var index: Int = 0

Current browser asset index in list.

is​Selected

@objc
    public dynamic var isSelected: Bool = false

Current browser asset is select or not.

select​Index

@objc
    public dynamic var selectIndex: Int = -1

Current browser asset index in selects.

select​Asset​Changed

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

Called when selet or deselect asset.

select​Asset​Exist​OrNot

public var selectAssetExistOrNot: ((Bool) -> Void)? 

Called whether selet asset is in list or not.

Methods

did​Index​Change(_:​)

public func didIndexChange(_ idx: Int?)  

Change current browser index.

Parameters

idx Int?

Asset index in list to browser.

did​Select​Index​Change(_:​)

public func didSelectIndexChange(_ idx: Int)  

Change select browser index.

Parameters

idx Int

Asset index in selects to browser.

append​Select(_:​)

public func appendSelect(_ idx: Int)  

Select the asset.

Parameters

idx Int

Index whitch asset is select.

delete​Select(_:​)

public func deleteSelect(_ idx: Int)  

Deselect the asset.

Parameters

index

Index whitch asset is deselect.

move​Select(from:​to:​reload:​)

public func moveSelect(from fIdx: Int, to tIdx: Int, reload: Bool = false)  

Change select assets order.

Parameters

fIdx Int

Index move from.

tIdx Int

Index move to.

reload Bool

Indicator reload selectView or not.