forked from CodeEditApp/CodeEdit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSplitView.swift
More file actions
37 lines (32 loc) · 998 Bytes
/
SplitView.swift
File metadata and controls
37 lines (32 loc) · 998 Bytes
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
//
// SplitView.swift
// CodeEdit
//
// Created by Wouter Hennen on 22/02/2023.
//
import SwiftUI
struct SplitView<Content: View>: View {
var axis: Axis
var dividerStyle: CodeEditDividerStyle
var content: Content
init(axis: Axis, dividerStyle: CodeEditDividerStyle = .system(.thin), @ViewBuilder content: () -> Content) {
self.axis = axis
self.dividerStyle = dividerStyle
self.content = content()
}
@State private var viewController: () -> SplitViewController? = { nil }
var body: some View {
VStack {
content.variadic { children in
SplitViewControllerView(
axis: axis,
dividerStyle: dividerStyle,
children: children,
viewController: $viewController
)
}
}
._trait(SplitViewControllerLayoutValueKey.self, viewController)
.accessibilityElement(children: .contain)
}
}