1 |
//
|
|
2 |
// ChatLayout
|
|
3 |
// ChatLayoutPositionSnapshot.swift
|
|
4 |
// https://github.com/ekazaev/ChatLayout
|
|
5 |
//
|
|
6 |
// Created by Eugene Kazaev in 2020-2022.
|
|
7 |
// Distributed under the MIT license.
|
|
8 |
//
|
|
9 |
|
|
10 |
import Foundation
|
|
11 |
import UIKit
|
|
12 |
|
|
13 |
/// Represents content offset position expressed by the specific item and it offset from the top or bottom edge.
|
|
14 |
public struct ChatLayoutPositionSnapshot {
|
|
15 |
|
|
16 |
/// Represents the edge.
|
|
17 |
public enum Edge {
|
|
18 |
|
|
19 |
/// Top edge of the `UICollectionView`
|
|
20 |
case top
|
|
21 |
|
|
22 |
/// Bottom edge of the `UICollectionView`
|
|
23 |
case bottom
|
|
24 |
|
|
25 |
}
|
|
26 |
|
|
27 |
/// Item's `IndexPath`
|
|
28 |
public var indexPath: IndexPath
|
|
29 |
|
|
30 |
/// Kind of item at the `indexPath`
|
|
31 |
public var kind: ItemKind
|
|
32 |
|
|
33 |
/// The edge of the offset.
|
|
34 |
public var edge: Edge
|
|
35 |
|
|
36 |
/// The offset from the `edge`.
|
|
37 |
public var offset: CGFloat
|
|
38 |
|
|
39 |
/// Constructor
|
|
40 |
/// - Parameters:
|
|
41 |
/// - indexPath: Item's `IndexPath`
|
|
42 |
/// - edge: The edge of the offset.
|
|
43 |
/// - offset: The offset from the `edge`.
|
|
44 |
/// - kind: Kind of item at the `indexPath`
|
|
45 |
public init(indexPath: IndexPath,
|
|
46 |
kind: ItemKind,
|
|
47 |
edge: Edge,
|
|
48 |
offset: CGFloat = 0) {
|
! |
49 |
self.indexPath = indexPath
|
! |
50 |
self.edge = edge
|
! |
51 |
self.offset = offset
|
! |
52 |
self.kind = kind
|
! |
53 |
}
|
! |
54 |
|
|
55 |
}
|
|