forked from open-trackers/Gym-Routine-Tracker-Plus-App
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainLandscape.swift
More file actions
64 lines (56 loc) · 1.97 KB
/
Copy pathMainLandscape.swift
File metadata and controls
64 lines (56 loc) · 1.97 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
//
// MainLandscape.swift
//
// Copyright 2023 OpenAlloc LLC
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//
import os
import SwiftUI
import GroutLib
import GroutUI
import TrackerUI
struct MainLandscape: View {
@Environment(\.managedObjectContext) private var viewContext
@EnvironmentObject private var manager: CoreDataStack
@SceneStorage(mainNavDataRoutineKey) private var routineNavData: Data?
@SceneStorage(mainNavDataHistoryKey) private var historyNavData: Data?
var body: some View {
HStack {
GroutNavStack(navData: $routineNavData,
stackIdentifier: "Routines",
destination: destination)
{
RoutineList()
}
GroutNavStack(navData: $historyNavData,
stackIdentifier: "History",
destination: destination)
{
PlusRecentRoutineRun(withSettings: true)
}
}
}
private func destination(router: GroutRouter, route: GroutRoute) -> some View {
Destination(route: route)
.environmentObject(router)
.environment(\.managedObjectContext, viewContext)
}
}
struct MainLandscape_Previews: PreviewProvider {
static var previews: some View {
let manager = CoreDataStack.getPreviewStack()
let ctx = manager.container.viewContext
let routine = Routine.create(ctx, userOrder: 0)
routine.name = "Back & Bicep"
let e1 = Exercise.create(ctx, routine: routine, userOrder: 0)
e1.name = "Lat Pulldown"
let e2 = Exercise.create(ctx, routine: routine, userOrder: 1)
e2.name = "Arm Curl"
return MainLandscape()
.environment(\.managedObjectContext, ctx)
.environmentObject(manager)
}
}