-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathAdapterType.swift
28 lines (21 loc) · 947 Bytes
/
AdapterType.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Foundation
public protocol AdapterType {
associatedtype `Type`
associatedtype ViewType
/// Returns the element currently on the front buffer at the given index path.
func displayedElement(at index: Int) -> Type
/// The total number of elements currently displayed.
func countDisplayedElements() -> Int
/// Replace the elements buffer and compute the diffs.
/// - parameter newValues: The new values.
/// - parameter synchronous: Wether the filter, sorting and diff should be executed
/// synchronously or not.
/// - parameter completion: Code that will be executed once the buffer is updated.
func update(with values: [Type]?, synchronous: Bool, completion: (() -> Void)?)
/// The section index associated with this adapter.
var sectionIndex: Int { get set }
/// The target view.
var view: ViewType? { get }
init(buffer: BufferType, view: ViewType)
init(initialElements: [Type], view: ViewType)
}