Skip to content

Commit 5ca4728

Browse files
committed
Add a HomeView Skeleton
1 parent 5da7584 commit 5ca4728

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

RubyEvents/views/HomeView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct HomeView: View {
2323
var body: some View {
2424
GeometryReader { geometry in
2525
if isLoading {
26-
ProgressView("Loading events...").frame(maxWidth: .infinity, maxHeight: .infinity)
26+
HomeViewSkeleton().frame(maxWidth: .infinity, maxHeight: .infinity)
2727
} else if let error = errorMessage {
2828
VStack {
2929
Text("Error loading data")
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
//
2+
// HomeViewSkeleton.swift
3+
// RubyEvents
4+
//
5+
// Created by Marco Roth on 31.03.2025.
6+
//
7+
8+
import SwiftUI
9+
10+
struct HomeViewSkeleton: View {
11+
@State private var isAnimating = false
12+
13+
var body: some View {
14+
GeometryReader { geometry in
15+
ScrollView() {
16+
RoundedRectangle(cornerRadius: 0)
17+
.fill(Color.gray.opacity(0.2))
18+
.frame(maxWidth: .infinity)
19+
.frame(height: (geometry.size.height / 5) * 3.5)
20+
.opacity(isAnimating ? 1 : 0.2)
21+
.animation(Animation.easeInOut(duration: 1.5).repeatForever(autoreverses: true), value: isAnimating)
22+
23+
VStack(spacing: 24) {
24+
ForEach(0..<2, id: \.self) { index in
25+
VStack(alignment: .leading, spacing: 12) {
26+
RoundedRectangle(cornerRadius: 4)
27+
.fill(Color.gray.opacity(0.2))
28+
.frame(width: 150, height: 24)
29+
.padding(.horizontal)
30+
.opacity(isAnimating ? 0.5 : 0.5)
31+
.animation(Animation.easeInOut(duration: 1.5).repeatForever(autoreverses: true).delay(0.1 * Double(index)), value: isAnimating)
32+
33+
HStack(spacing: 16) {
34+
ForEach(0..<4, id: \.self) { itemIndex in
35+
RoundedRectangle(cornerRadius: 8)
36+
.fill(Color.gray.opacity(0.2))
37+
.frame(width: 200, height: 120)
38+
.opacity(isAnimating ? 1 : 0.5)
39+
.animation(Animation.easeInOut(duration: 1.5).repeatForever(autoreverses: true).delay(0.1 * Double(itemIndex)), value: isAnimating)
40+
}
41+
}
42+
.padding(.horizontal)
43+
44+
}
45+
}
46+
}
47+
.padding(.top, 24)
48+
}
49+
.edgesIgnoringSafeArea(.top)
50+
}
51+
.onAppear {
52+
App.instance.tabBarController.hideNavigationBarFor(title: "Home")
53+
isAnimating = true
54+
}
55+
}
56+
}
57+
58+
#Preview {
59+
HomeViewSkeleton()
60+
}

0 commit comments

Comments
 (0)