8
8
9
9
import SwiftUI
10
10
11
- let statusBarHeight = UIApplication . shared. statusBarFrame. height
11
+ let window = UIApplication . shared. windows. filter { $0. isKeyWindow} . first
12
+ let statusBarHeight = window? . windowScene? . statusBarManager? . statusBarFrame. height ?? 0
12
13
let screen = UIScreen . main. bounds
13
14
14
15
struct Home : View {
@@ -17,7 +18,7 @@ struct Home: View {
17
18
@State var showProfile = false
18
19
19
20
var body : some View {
20
- ZStack {
21
+ ZStack ( alignment : . top ) {
21
22
HomeList ( )
22
23
. blur ( radius: show ? 20 : 0 )
23
24
. scaleEffect ( showProfile ? 0.95 : 1 )
@@ -30,12 +31,16 @@ struct Home: View {
30
31
. animation ( . spring( ) )
31
32
. offset ( y: showProfile ? statusBarHeight + 40 : UIScreen . main. bounds. height)
32
33
33
- MenuButton ( show: $show)
34
- . offset ( x: - 40 , y: showProfile ? statusBarHeight : 80 )
35
- . animation ( . spring( ) )
34
+ HStack {
35
+ MenuButton ( show: $show)
36
+ . offset ( x: - 40 )
37
+ Spacer ( )
36
38
37
- MenuRight ( show: $showProfile)
38
- . offset ( x: - 16 , y: showProfile ? statusBarHeight : 88 )
39
+ MenuRight ( show: $showProfile)
40
+ . offset ( x: - 16 )
41
+ }
42
+ . offset ( y: showProfile ? statusBarHeight : 80 )
43
+ . animation ( . spring( ) )
39
44
40
45
MenuView ( show: $show)
41
46
}
@@ -84,7 +89,7 @@ let menuData = [
84
89
Menu ( title: " My Account " , icon: " person.crop.circle " ) ,
85
90
Menu ( title: " Settings " , icon: " gear " ) ,
86
91
Menu ( title: " Billing " , icon: " creditcard " ) ,
87
- Menu ( title: " Team " , icon: " person.and.person " ) ,
92
+ Menu ( title: " Team " , icon: " person.2 " ) ,
88
93
Menu ( title: " Sign out " , icon: " arrow.uturn.down " )
89
94
]
90
95
@@ -119,7 +124,7 @@ struct MenuView: View {
119
124
. rotation3DEffect ( Angle ( degrees: show ? 0 : 60 ) , axis: ( x: 0 , y: 10.0 , z: 0 ) )
120
125
. animation ( . default)
121
126
. offset ( x: show ? 0 : - UIScreen. main. bounds. width)
122
- . tapAction {
127
+ . onTapGesture {
123
128
self . show. toggle ( )
124
129
}
125
130
Spacer ( )
0 commit comments