11import SwiftUI
22
3- // Remove duplicate ShimmeringEffect - use the one from UI/Extensions/View+Shimmering.swift instead
4-
53struct SchoolArrangementSkeletonView : View {
4+ // Animation states
5+ @State private var animateItems = false
6+
67 var body : some View {
78 VStack ( spacing: 16 ) {
89 ForEach ( 0 ..< 5 , id: \. self) { index in
@@ -13,7 +14,6 @@ struct SchoolArrangementSkeletonView: View {
1314 . fill ( Color . gray. opacity ( 0.2 ) )
1415 . frame ( height: 22 )
1516 . frame ( width: 200 )
16- //.shimmering()
1717
1818 Spacer ( )
1919
@@ -22,7 +22,6 @@ struct SchoolArrangementSkeletonView: View {
2222 . fill ( Color . gray. opacity ( 0.2 ) )
2323 . frame ( height: 16 )
2424 . frame ( width: 100 )
25- //.shimmering()
2625 }
2726
2827 // Week numbers skeleton
@@ -31,7 +30,6 @@ struct SchoolArrangementSkeletonView: View {
3130 RoundedRectangle ( cornerRadius: 12 )
3231 . fill ( Color . gray. opacity ( 0.2 ) )
3332 . frame ( width: 40 , height: 24 )
34- //.shimmering()
3533 }
3634
3735 Spacer ( )
@@ -42,8 +40,23 @@ struct SchoolArrangementSkeletonView: View {
4240 RoundedRectangle ( cornerRadius: 12 )
4341 . fill ( Color ( UIColor . secondarySystemBackground) )
4442 )
43+ . opacity ( animateItems ? 1 : 0.4 )
44+ . offset ( y: animateItems ? 0 : 10 )
45+ . animation (
46+ . spring( response: 0.5 , dampingFraction: 0.8 )
47+ . delay ( Double ( index) * 0.07 ) ,
48+ value: animateItems
49+ )
4550 }
4651 }
4752 . padding ( )
53+ . onAppear {
54+ withAnimation ( . easeOut( duration: 0.4 ) ) {
55+ animateItems = true
56+ }
57+ }
58+ . onDisappear {
59+ animateItems = false
60+ }
4861 }
4962}
0 commit comments