Guest User

MainView

a guest
Aug 22nd, 2022
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.77 KB | None | 0 0
  1. import SwiftUI
  2.  
  3. struct MainView: View {
  4.  
  5. //let possibleBackgroundColor = RadialGradient(colors: [Color(#colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1)), Color.black], center: .top, startRadius: 5, endRadius: UIScreen.main.bounds.height).ignoresSafeArea()
  6. @State private var selection: Int = 1
  7.  
  8. var body: some View {
  9. TabView(selection: $selection) {
  10.  
  11. HomeView()
  12. .tabItem {
  13. Image(systemName: "house.fill")
  14. Text("Home")
  15. }
  16. .tag(0)
  17. PlanView()
  18. .tabItem {
  19. Image(systemName: "stopwatch")
  20. Text("Workout")
  21. }
  22. .tag(1)
  23. ProfileView()
  24. .tabItem {
  25. Image(systemName: "person.fill")
  26. Text("Profile")
  27. }
  28. .tag(2)
  29.  
  30.  
  31. }
  32. .accentColor(.red)
  33.  
  34. }
  35. }
  36.  
  37.  
  38.  
  39.  
  40. struct MainView_Previews: PreviewProvider {
  41. static var previews: some View {
  42. MainView()
  43. }
  44. }
  45.  
  46. struct HomeView: View {
  47. var body: some View {
  48. ZStack {
  49. Text("HOME")
  50.  
  51. }
  52.  
  53. }
  54. }
  55.  
  56. struct PlanView: View {
  57.  
  58. let workouts = workoutsData
  59.  
  60. var body: some View {
  61. VStack(alignment: .leading) {
  62. HStack {
  63. Text("My Workouts")
  64. .font(.title)
  65. .fontWeight(.semibold)
  66. .padding()
  67. Spacer()
  68. }
  69. ScrollView(.horizontal, showsIndicators: false) {
  70. HStack(spacing: 20) {
  71. ForEach(workouts) { card in
  72. MyWorkoutsCards()
  73. }
  74. }
  75. }
  76. .offset(x: 0, y: -25)
  77. .padding()
  78.  
  79.  
  80.  
  81. HStack {
  82. Text("Discover")
  83. .font(.largeTitle)
  84. .fontWeight(.semibold)
  85. .padding()
  86. }
  87. HStack(spacing: 20) {
  88. ZStack {
  89. PersonalizedCard()
  90. .onTapGesture {
  91. /* Personalized Screen
  92.  
  93. CHECK FOR SUBSCRIPTION
  94. */
  95. }
  96. }
  97. }
  98. .padding()
  99.  
  100. }
  101.  
  102. }
  103. }
  104.  
  105.  
  106. struct ProfileView: View {
  107. var body: some View {
  108. Text("Profile View")
  109. }
  110. }
Advertisement
Add Comment
Please, Sign In to add comment