-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDemoSheetViewController.swift
More file actions
127 lines (96 loc) · 4.21 KB
/
Copy pathDemoSheetViewController.swift
File metadata and controls
127 lines (96 loc) · 4.21 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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import CompositionKit
import FluidInterfaceKit
import FluidInterfaceKitRideauSupport
import Foundation
import MondrianLayout
import StorybookKit
import UIKit
final class DemoSheetViewController: FluidStackController {
init() {
super.init(rootViewController: ListViewController())
}
}
private final class ListViewController: CodeBasedViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
Mondrian.buildSubviews(on: view) {
ZStackBlock {
VStackBlock {
Components.makeSelection()&>.do {
$0.handlers.onTap = { [unowned self] in
let controller = DetailViewController()
fluidPush(controller, target: .current)
print("hey")
}
}
}
}
}
}
private enum Components {
static func makeSelection() -> InteractiveView<UIView> {
return InteractiveView(
animation: .bodyShrink,
haptics: .impactOnTouchUpInside(),
useLongPressGesture: false,
contentView: AnyView { _ in
VStackBlock {
UILabel()&>.do {
$0.text = "💡 Light bulb"
$0.font = UIFont.boldSystemFont(ofSize: 16)
}
.viewBlock
.padding(10)
.background(ShapeLayerView.roundedCorner(radius: 6)&>.do {
$0.shapeFillColor = .init(white: 0.5, alpha: 0.3)
})
}
}
)
}
}
}
private final class DetailViewController: FluidSheetViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .systemBackground
let horizontalContent = ScrollableContainerView(scrollDirection: .horizontal)
horizontalContent.setContent(AnyView { _ in
HStackBlock(spacing: 8) {
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
}
})
let verticalContent = ScrollableContainerView(scrollDirection: .vertical)
verticalContent.setContent(AnyView { _ in
VStackBlock(spacing: 8) {
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
UIView.mock(backgroundColor: .neon(.purple), preferredSize: .init(width: 60, height: 60))
}
})
Mondrian.buildSubviews(on: view) {
VStackBlock {
horizontalContent
verticalContent
}
.container(respectingSafeAreaEdges: .all)
}
}
}