forked from amirdew/CollectionViewPagingLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPagingCollectionViewModifierData.swift
More file actions
45 lines (39 loc) · 1.37 KB
/
PagingCollectionViewModifierData.swift
File metadata and controls
45 lines (39 loc) · 1.37 KB
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
//
// PagingCollectionViewModifierData.swift
// CollectionViewPagingLayout
//
// Created by Amir Khorsandi on 10/04/2021.
// Copyright © 2021 Amir Khorsandi. All rights reserved.
//
import Foundation
import UIKit
struct PagingCollectionViewModifierData {
var scaleOptions: ScaleTransformViewOptions?
var stackOptions: StackTransformViewOptions?
var snapshotOptions: SnapshotTransformViewOptions?
var snapshotIdentifier: ((Int, UIView?) -> String)?
var canReuseSnapshot: ((SnapshotContainerView, UIView?) -> Bool)?
var numberOfVisibleItems: Int?
var zPositionProvider: ((CGFloat) -> Int)?
var animator: ViewAnimator?
var goToSelectedPage: Bool?
var collectionViewProperties: [CollectionViewPropertyProtocol] = []
var onTapPage: ((Int) -> Void)?
var scrollDirection: UICollectionView.ScrollDirection?
var pagePadding: PagePadding?
var transparentAttributeWhenCellNotLoaded: Bool?
}
protocol CollectionViewPropertyProtocol {
func getKey<T>() -> WritableKeyPath<UICollectionView, T>?
func getValue<T>() -> T?
}
struct CollectionViewProperty<T>: CollectionViewPropertyProtocol {
let keyPath: WritableKeyPath<UICollectionView, T>
let value: T
func getKey<T>() -> WritableKeyPath<UICollectionView, T>? {
keyPath as? WritableKeyPath<UICollectionView, T>
}
func getValue<T>() -> T? {
value as? T
}
}