initial start screen
Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>
This commit is contained in:
parent
d8a34ad1ce
commit
9b0287f038
@ -13,7 +13,7 @@ struct ContentView: View {
|
|||||||
Image(systemName: "globe")
|
Image(systemName: "globe")
|
||||||
.imageScale(.large)
|
.imageScale(.large)
|
||||||
.foregroundStyle(.tint)
|
.foregroundStyle(.tint)
|
||||||
Text("Hello, world!")
|
Text("Fitness App!")
|
||||||
}
|
}
|
||||||
.padding()
|
.padding()
|
||||||
}
|
}
|
||||||
|
|||||||
42
FitnessApp/FitnessTabView.swift
Normal file
42
FitnessApp/FitnessTabView.swift
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
//
|
||||||
|
// FitnessTabView.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct FitnessTabView: View {
|
||||||
|
@State var selectedTab = "Home"
|
||||||
|
|
||||||
|
init() {
|
||||||
|
let appearace = UITabBarAppearance()
|
||||||
|
appearace.configureWithOpaqueBackground()
|
||||||
|
appearace.stackedLayoutAppearance.selected.iconColor = .green
|
||||||
|
appearace.stackedLayoutAppearance.selected.titleTextAttributes =
|
||||||
|
[.foregroundColor: UIColor.label]
|
||||||
|
UITabBar.appearance().scrollEdgeAppearance = appearace
|
||||||
|
}
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
TabView(selection: $selectedTab) {
|
||||||
|
HomeView()
|
||||||
|
.tag("Home")
|
||||||
|
.tabItem {
|
||||||
|
Image(systemName: "house")
|
||||||
|
Text("Home")
|
||||||
|
}
|
||||||
|
HistoricDataView()
|
||||||
|
.tag("Historic")
|
||||||
|
.tabItem {
|
||||||
|
Image(systemName: "chart.line.uptrend.xyaxis")
|
||||||
|
Text("Historic")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
FitnessTabView()
|
||||||
|
}
|
||||||
18
FitnessApp/HistoricDataView.swift
Normal file
18
FitnessApp/HistoricDataView.swift
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// HistoricDataView.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct HistoricDataView: View {
|
||||||
|
var body: some View {
|
||||||
|
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
HistoricDataView()
|
||||||
|
}
|
||||||
82
FitnessApp/HomeView.swift
Normal file
82
FitnessApp/HomeView.swift
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
//
|
||||||
|
// HomeView.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct HomeView: View {
|
||||||
|
@State var calories: Int = 123
|
||||||
|
@State var active: Int = 205
|
||||||
|
@State var stand: Int = 80
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ScrollView(showsIndicators: false) {
|
||||||
|
VStack {
|
||||||
|
Text("Wecome")
|
||||||
|
.font(.largeTitle)
|
||||||
|
.padding()
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
Text("Calories")
|
||||||
|
.font(.callout)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.red)
|
||||||
|
|
||||||
|
Text("123 kcal")
|
||||||
|
.bold()
|
||||||
|
}.padding(.bottom)
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
Text("Active")
|
||||||
|
.font(.callout)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.green)
|
||||||
|
|
||||||
|
Text("52 mins")
|
||||||
|
.bold()
|
||||||
|
}.padding(.bottom)
|
||||||
|
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
Text("Stand")
|
||||||
|
.font(.callout)
|
||||||
|
.bold()
|
||||||
|
.foregroundColor(.blue)
|
||||||
|
|
||||||
|
Text("8 hrs")
|
||||||
|
.bold()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
ZStack {
|
||||||
|
Spacer()
|
||||||
|
ProgressCircleView(progress: $calories, goal: 600, color: .red)
|
||||||
|
ProgressCircleView(progress: $active, goal: 600, color: .green).padding(.all, 20)
|
||||||
|
ProgressCircleView(progress: $stand, goal: 600, color: .blue).padding(.all, 40)
|
||||||
|
}
|
||||||
|
.padding(.horizontal)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
HomeView()
|
||||||
|
}
|
||||||
17
FitnessApp/ProfileView.swift
Normal file
17
FitnessApp/ProfileView.swift
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// ProfileView.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ProfileView: View {
|
||||||
|
var body: some View {
|
||||||
|
Text("Profile")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
HomeView()
|
||||||
|
}
|
||||||
31
FitnessApp/ProgressCircleView.swift
Normal file
31
FitnessApp/ProgressCircleView.swift
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
//
|
||||||
|
// ProgressCircle.swift
|
||||||
|
// FitnessApp
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 12/20/24.
|
||||||
|
//
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct ProgressCircleView: View {
|
||||||
|
@Binding var progress: Int
|
||||||
|
var goal: Int
|
||||||
|
var color: Color
|
||||||
|
private let width: CGFloat = 20
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
ZStack {
|
||||||
|
Circle()
|
||||||
|
.stroke(color.opacity(0.3), lineWidth: width)
|
||||||
|
|
||||||
|
Circle()
|
||||||
|
.trim(from: 0, to: CGFloat(progress) / CGFloat(goal))
|
||||||
|
.stroke(color, style: StrokeStyle(lineWidth: 20, lineCap: .round))
|
||||||
|
.rotationEffect(Angle(degrees: -90))
|
||||||
|
.shadow(radius: 5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Preview {
|
||||||
|
ProgressCircleView(progress: .constant(100), goal: 200, color: .gray)
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user