-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathGlidingCollectionDelegate.swift
49 lines (38 loc) · 1.62 KB
/
GlidingCollectionDelegate.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// GlidingCollectionDelegate.swift
// GlidingCollection
//
// Created by Abdurahim Jauzee on 11/03/2017.
// Copyright © 2017 Ramotion Inc. All rights reserved.
//
import Foundation
/// This delegate provides methods which can notify when transition starts/ends & when item was selected.
public protocol GlidingCollectionDelegate {
/// This method will be called before starting
/// transition from one item to another.
///
/// - Parameters:
/// - collection: GlidingCollection
/// - index: Index of item that being expand.
func glidingCollection(_ collection: GlidingCollection, willExpandItemAt index: Int)
/// This method will be called when transition
/// between items was finished.
///
/// - Parameters:
/// - collection: GlidingCollection
/// - index: Index of expanded item.
func glidingCollection(_ collection: GlidingCollection, didExpandItemAt index: Int)
/// This method will be called if selected
/// one of the element of vertical stack.
///
/// - Parameters:
/// - collection: GlidingCollection
/// - index: Index of selected item.
func glidingCollection(_ collection: GlidingCollection, didSelectItemAt index: Int)
}
// This extension will make all this methods optional so you can implement just part of this protocol if you wish.
public extension GlidingCollectionDelegate {
func glidingCollection(_ collection: GlidingCollection, willExpandItemAt index: Int) { }
func glidingCollection(_ collection: GlidingCollection, didExpandItemAt index: Int) { }
func glidingCollection(_ collection: GlidingCollection, didSelectItemAt index: Int) { }
}