-
Notifications
You must be signed in to change notification settings - Fork 93
/
Copy pathElongationConfig.swift
108 lines (84 loc) · 3.45 KB
/
ElongationConfig.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//
// ElongationConfig.swift
// ElongationPreview
//
// Created by Abdurahim Jauzee on 09/02/2017.
// Copyright © 2017 Ramotion. All rights reserved.
//
import UIKit
/// Whole module views configuration
public struct ElongationConfig {
/// Empty public initializer.
public init() {}
/// Shared instance. Override this property to apply changes.
public static var shared = ElongationConfig()
// MARK: Behaviour 🔧
/// :nodoc:
public enum CellTouchAction {
case collapseOnTopExpandOnBottom, collapseOnBottomExpandOnTop, collapseOnBoth, expandOnBoth, expandOnTop, expandOnBottom
}
/// What `elongationCell` should do on touch
public var cellTouchAction = CellTouchAction.collapseOnTopExpandOnBottom
/// :nodoc:
public enum HeaderTouchAction {
case collpaseOnBoth, collapseOnTop, collapseOnBottom, noAction
}
/// What `elongationHeader` should do on touch
public var headerTouchAction = HeaderTouchAction.collapseOnTop
/// Enable gestures on `ElongationCell` & `ElongationHeader`.
/// These gestures will give ability to expand/dismiss the cell and detail view controller.
/// Default value: `true`
public var isSwipeGesturesEnabled = true
/// Enable `UIPreviewIntearction` on `ElongationCell`.
/// Default value: `true`
public var forceTouchPreviewInteractionEnabled = true
/// Enable `UILongPressGesture` on `ElongationCell`.
/// This gesture will allow to `expand` `ElongationCell` on long tap. By default, this option will be used on devices without 3D Touch technology.
/// Default value: `true`
public var longPressGestureEnabled = true
// MARK: Appearance 🎨
/// Actual height of `topView`.
/// Default value: `200`
public var topViewHeight: CGFloat = 200
/// `topView` scale value which will be used for making CGAffineTransform
/// to `expanded` state
/// Default value: `0.9`
public var scaleViewScaleFactor: CGFloat = 0.9
/// Parallax effect factor.
/// Default value: `nil`
public var parallaxFactor: CGFloat?
/// Should we enable parallax effect on ElongationCell (read-only).
/// Will be `true` if `separator` not `nil` && greater than zero
public var isParallaxEnabled: Bool {
switch parallaxFactor {
case .none: return false
case let .some(value): return value > 0
}
}
/// Offset of `bottomView` against `topView`
/// Default value: `20`
public var bottomViewOffset: CGFloat = 20
/// `bottomView` height value
/// Default value: `180`
public var bottomViewHeight: CGFloat = 180
/// Height of custom separator line between cells in tableView
/// Default value: `nil`
public var separatorHeight: CGFloat?
/// Color of custom separator
/// Default value: `.white`
public var separatorColor: UIColor = .white
/// Should we create custom separator view (read-only).
/// Will be `true` if `separator` not `nil` && greater than zero.
public var customSeparatorEnabled: Bool {
switch separatorHeight {
case .none: return false
case let .some(value): return value > 0
}
}
/// Duration of `detail` view controller presentation animation
/// Default value: `0.3`
public var detailPresentingDuration: TimeInterval = 0.3
/// Duration of `detail` view controller dismissing animation
/// Default value: `0.4`
public var detailDismissingDuration: TimeInterval = 0.4
}