-
Notifications
You must be signed in to change notification settings - Fork 265
Expand file tree
/
Copy pathProvider.swift
More file actions
39 lines (30 loc) · 828 Bytes
/
Provider.swift
File metadata and controls
39 lines (30 loc) · 828 Bytes
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
29
30
31
32
33
34
35
36
37
38
39
//
// Provider.swift
// CollectionKit
//
// Created by Luke Zhao on 2017-07-23.
// Copyright © 2017 lkzhao. All rights reserved.
//
import UIKit
public protocol Provider {
var identifier: String? { get }
// data
var numberOfItems: Int { get }
func identifier(at: Int) -> String
// layout
func layout(collectionSize: CGSize)
func visible(in visibleFrame: CGRect) -> (indexes: [Int], frame: CGRect)
var contentSize: CGSize { get }
func frame(at: Int) -> CGRect
// event
func willReload()
func didReload()
func animator(at: Int) -> Animator?
// determines if a context belongs to current provider
func hasReloadable(_ reloadable: CollectionReloadable) -> Bool
func flattenedProvider() -> ItemProvider
}
extension Provider {
public func willReload() {}
public func didReload() {}
}