Skip to content

Commit 752b1f9

Browse files
author
Mithun
committed
Adapting for iPad
1 parent f28953e commit 752b1f9

File tree

8 files changed

+98
-41
lines changed

8 files changed

+98
-41
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
},
6+
"colors" : [
7+
{
8+
"idiom" : "universal",
9+
"color" : {
10+
"color-space" : "srgb",
11+
"components" : {
12+
"red" : "1.000",
13+
"alpha" : "1.000",
14+
"blue" : "1.000",
15+
"green" : "1.000"
16+
}
17+
}
18+
},
19+
{
20+
"idiom" : "universal",
21+
"appearances" : [
22+
{
23+
"appearance" : "luminosity",
24+
"value" : "dark"
25+
}
26+
],
27+
"color" : {
28+
"color-space" : "srgb",
29+
"components" : {
30+
"red" : "0x11",
31+
"alpha" : "1.000",
32+
"blue" : "0x11",
33+
"green" : "0x11"
34+
}
35+
}
36+
}
37+
]
38+
}

DesignCode/Assets.xcassets/Colors/buttonShadow.colorset/Contents.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
"color" : {
1010
"color-space" : "srgb",
1111
"components" : {
12-
"red" : "0x00",
13-
"alpha" : "0.250",
14-
"blue" : "0x00",
15-
"green" : "0x00"
12+
"red" : "0x9C",
13+
"alpha" : "0.300",
14+
"blue" : "0xB9",
15+
"green" : "0xA5"
1616
}
1717
}
1818
},
@@ -27,10 +27,10 @@
2727
"color" : {
2828
"color-space" : "srgb",
2929
"components" : {
30-
"red" : "0.000",
31-
"alpha" : "1.000",
32-
"blue" : "0.000",
33-
"green" : "0.000"
30+
"red" : "0x00",
31+
"alpha" : "0.300",
32+
"blue" : "0x00",
33+
"green" : "0x00"
3434
}
3535
}
3636
}

DesignCode/CertificateRow.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct CertificateRow: View {
1717
Text("Certificates")
1818
.font(.system(size: 20))
1919
.fontWeight(.heavy)
20-
.padding(.leading, 20)
20+
.padding(.leading, 30)
2121

2222
ScrollView(.horizontal, showsIndicators: false) {
2323
HStack(spacing: 20) {
@@ -26,7 +26,7 @@ struct CertificateRow: View {
2626
}
2727
}
2828
.padding(20)
29-
.padding(.leading, 20)
29+
.padding(.leading, 10)
3030
}
3131
}
3232
}

DesignCode/ContentView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,6 @@ struct CardBottomView: View {
160160
.background(BlurView(style: .systemMaterial))
161161
.cornerRadius(30)
162162
.shadow(radius: 20)
163-
.offset(y: 600)
163+
.offset(y: UIScreen.main.bounds.height - 170)
164164
}
165165
}

DesignCode/Home.swift

+41-23
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
import SwiftUI
1010

11+
let statusBarHeight = UIApplication.shared.statusBarFrame.height
12+
let screen = UIScreen.main.bounds
13+
1114
struct Home: View {
1215

1316
@State var show = false
@@ -21,20 +24,23 @@ struct Home: View {
2124
.animation(.default)
2225

2326
ContentView()
27+
.frame(minWidth: 0, maxWidth: 712)
2428
.cornerRadius(30)
2529
.shadow(radius: 20)
2630
.animation(.fluidSpring())
27-
.offset(y: showProfile ? 40 : UIScreen.main.bounds.height)
31+
.offset(y: showProfile ? statusBarHeight + 40 : UIScreen.main.bounds.height)
2832

2933
MenuButton(show: $show)
30-
.offset(x: -30, y: showProfile ? 0 : 80)
34+
.offset(x: -40, y: showProfile ? statusBarHeight : 80)
3135
.animation(.fluidSpring())
3236

3337
MenuRight(show: $showProfile)
34-
.offset(x: -16, y: showProfile ? 0 : 88)
38+
.offset(x: -16, y: showProfile ? statusBarHeight : 88)
3539

3640
MenuView(show: $show)
3741
}
42+
.background(Color("background"))
43+
.edgesIgnoringSafeArea(.all)
3844
}
3945
}
4046

@@ -60,6 +66,7 @@ struct MenuRow: View {
6066

6167
Text(text)
6268
.font(.headline)
69+
.color(.primary)
6370

6471
Spacer()
6572
}
@@ -74,6 +81,7 @@ struct Menu: Identifiable {
7481

7582
let menuData = [
7683
Menu(title: "My Account", icon: "person.crop.circle"),
84+
Menu(title: "Settings", icon: "gear"),
7785
Menu(title: "Billing", icon: "creditcard"),
7886
Menu(title: "Team", icon: "person.and.person"),
7987
Menu(title: "Sign out", icon: "arrow.uturn.down")
@@ -85,25 +93,35 @@ struct MenuView: View {
8593
@Binding var show: Bool
8694

8795
var body: some View {
88-
return VStack(alignment: .leading) {
89-
ForEach(menu) { item in
90-
MenuRow(image: item.icon, text: item.title)
96+
return HStack {
97+
VStack(alignment: .leading) {
98+
ForEach(menu) { item in
99+
if item.title == "Settings" {
100+
PresentationLink(destination: Settings()) {
101+
MenuRow(image: item.icon, text: item.title)
102+
}
103+
} else {
104+
MenuRow(image: item.icon, text: item.title)
105+
}
106+
}
107+
Spacer()
108+
}
109+
.padding(.top, 20)
110+
.padding(30)
111+
.frame(minWidth: 0, maxWidth: 360)
112+
.background(Color("button"))
113+
.cornerRadius(30)
114+
.padding(.trailing, 60)
115+
.shadow(radius: 20)
116+
.rotation3DEffect(Angle(degrees: show ? 0 : 60), axis: (x: 0, y: 10.0, z: 0))
117+
.animation(.basic())
118+
.offset(x: show ? 0 : -UIScreen.main.bounds.width)
119+
.tapAction {
120+
self.show.toggle()
91121
}
92122
Spacer()
93123
}
94-
.padding(.top, 20)
95-
.padding(30)
96-
.frame(minWidth: 0, maxWidth: .infinity)
97-
.background(BlurView(style: .systemMaterial))
98-
.cornerRadius(30)
99-
.padding(.trailing, 60)
100-
.shadow(radius: 20)
101-
.rotation3DEffect(Angle(degrees: show ? 0 : 60), axis: (x: 0, y: 10.0, z: 0))
102-
.animation(.basic())
103-
.offset(x: show ? 0 : -UIScreen.main.bounds.width)
104-
.tapAction {
105-
self.show.toggle()
106-
}
124+
.padding(.top, statusBarHeight)
107125
}
108126
}
109127

@@ -117,7 +135,7 @@ struct CircleButton: View {
117135
.foregroundColor(.primary)
118136
}
119137
.frame(width: 44, height: 44)
120-
.background(BlurView(style: .systemThickMaterial))
138+
.background(Color("button"))
121139
.cornerRadius(30)
122140
.shadow(color: Color("buttonShadow"), radius: 20, x: 0, y: 20)
123141
}
@@ -135,9 +153,9 @@ struct MenuButton: View {
135153
Image(systemName: "list.dash")
136154
.foregroundColor(.primary)
137155
}
138-
.padding(.trailing, 20)
156+
.padding(.trailing, 18)
139157
.frame(width: 90, height: 60)
140-
.background(BlurView(style: .systemThickMaterial))
158+
.background(Color("button"))
141159
.cornerRadius(30)
142160
.shadow(color: Color("buttonShadow"), radius: 20, x: 0, y: 20)
143161
}
@@ -156,7 +174,7 @@ struct MenuRight: View {
156174
Button(action: { self.show.toggle() }) {
157175
CircleButton(icon: "person.crop.circle")
158176
}
159-
Button(action: { self.show.toggle() }) {
177+
PresentationLink(destination: UpdateList()) {
160178
CircleButton(icon: "bell")
161179
}
162180
}

DesignCode/HomeList.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct HomeList: View {
2626
}
2727
Spacer()
2828
}
29-
.padding(.leading, 70.0)
29+
.padding(.leading, 60.0)
3030

3131
ScrollView(.horizontal, showsIndicators: false) {
3232
HStack(spacing: 30.0) {
@@ -37,17 +37,17 @@ struct HomeList: View {
3737
image: item.image,
3838
color: item.color,
3939
shadowColor: item.shadowColor)
40-
.rotation3DEffect(Angle(degrees: Double(geometry.frame(in: .global).minX - 40) / -20), axis: (x: 0, y: 10.0, z: 0))
40+
.rotation3DEffect(Angle(degrees: Double(geometry.frame(in: .global).minX - 30) / -40), axis: (x: 0, y: 10.0, z: 0))
4141
}
42-
.frame(width: 246, height: 150)
42+
.frame(width: 246, height: 360)
4343
}
4444
}
4545
}
46-
.padding(.leading, 40)
46+
.padding(.leading, 30)
4747
.padding(.top, 30)
48+
.padding(.bottom, 70)
4849
Spacer()
4950
}
50-
.frame(height: 450)
5151
CertificateRow()
5252
}
5353
.padding(.top, 78)

DesignCode/SceneDelegate.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
2121
// Use a UIHostingController as window root view controller
2222
if let windowScene = scene as? UIWindowScene {
2323
let window = UIWindow(windowScene: windowScene)
24-
window.rootViewController = UIHostingController(rootView: TabBar())
24+
window.rootViewController = UIHostingController(rootView: Home())
2525
self.window = window
2626
window.makeKeyAndVisible()
2727
}

DesignCode/TabBar.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ struct TabBar: View {
2727
}
2828
.tag(3)
2929
}
30+
.edgesIgnoringSafeArea(.top)
3031
}
3132
}
3233

3334
#if DEBUG
3435
struct TabBar_Previews: PreviewProvider {
3536
static var previews: some View {
3637
TabBar()
37-
.environment(\.colorScheme, .dark)
38+
// .environment(\.colorScheme, .dark)
3839
}
3940
}
4041
#endif

0 commit comments

Comments
 (0)