Class
ADAssetBrowserDataSource
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.
Relationships
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
Name | Type | Description |
---|---|---|
options | ADAssetBrowserOptions |
Options to control browser controller. It is |
list | [ADAssetBrowsable] |
Asset array to browser. |
selects | [ADAssetBrowsable] |
Assets have been selected. |
index | Int? |
Default asset index in |
Properties
options
public let options: ADAssetBrowserOptions
Options to control the asset browser condition and ui.
current
public var current: ADAssetBrowsable?
Current browser asset. Will be nil
if select asset is not in list
.
isSelected
@objc
public dynamic var isSelected: Bool = false
Current browser asset is select or not.
selectAssetChanged
public var selectAssetChanged: ((Int)->Void)?
Called when selet or deselect asset.
selectAssetExistOrNot
public var selectAssetExistOrNot: ((Bool) -> Void)?
Called whether selet asset is in list
or not.
Methods
didIndexChange(_:)
public func didIndexChange(_ idx: Int?)
Change current browser index.
Parameters
Name | Type | Description |
---|---|---|
idx | Int? |
Asset index in |
didSelectIndexChange(_:)
public func didSelectIndexChange(_ idx: Int)
Change select browser index.
Parameters
Name | Type | Description |
---|---|---|
idx | Int |
Asset index in |
appendSelect(_:)
public func appendSelect(_ idx: Int)
Select the asset.
Parameters
Name | Type | Description |
---|---|---|
idx | Int |
Index whitch asset is select. |
deleteSelect(_:)
public func deleteSelect(_ idx: Int)
Deselect the asset.
Parameters
Name | Type | Description |
---|---|---|
index | Index whitch asset is deselect. |
moveSelect(from:to:reload:)
public func moveSelect(from fIdx: Int, to tIdx: Int, reload: Bool = false)
Change select assets order.
Parameters
Name | Type | Description |
---|---|---|
fIdx | Int |
Index move from. |
tIdx | Int |
Index move to. |
reload | Bool |
Indicator reload |