forked from LoopKit/LoopKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationPageScrollView.swift
More file actions
38 lines (32 loc) · 1.07 KB
/
ConfigurationPageScrollView.swift
File metadata and controls
38 lines (32 loc) · 1.07 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
//
// ConfigurationPageScrollView.swift
// LoopKitUI
//
// Created by Pete Schwamb on 12/30/22.
// Copyright © 2022 LoopKit Authors. All rights reserved.
//
import SwiftUI
// ConfigurationPageScrollView is a ScrollView (not List) based configuration page.
// The optional action area is pinned to the bottom, but does not overlay any content
public struct ConfigurationPageScrollView<Content: View, ActionArea: View>: View {
var content: Content
var actionArea: ActionArea?
public init(@ViewBuilder content: () -> Content, @ViewBuilder actionArea: () -> ActionArea?) {
self.content = content()
self.actionArea = actionArea()
}
public var body: some View {
GeometryReader { geometry in
ScrollView {
VStack {
content
Spacer()
actionArea
}
.frame(minHeight: geometry.size.height)
}
.background(Color(.systemGroupedBackground))
.background(ignoresSafeAreaEdges: .bottom)
}
}
}