Skip to content

Commit 2408457

Browse files
authored
Merge pull request #3 from theromis/master
swift 5.1 and Xcode 11 fixes
2 parents 18e5c99 + 9369664 commit 2408457

6 files changed

+19
-14
lines changed

DesignCode/ContentView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct ContentView: View {
5252
.scaleEffect(0.95)
5353
.rotationEffect(Angle(degrees: show ? 5 : 0))
5454
.animation(.spring())
55-
.tapAction {
55+
.onTapGesture {
5656
self.show.toggle()
5757
}
5858
.gesture(

DesignCode/Home.swift

+14-9
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
import SwiftUI
1010

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
1213
let screen = UIScreen.main.bounds
1314

1415
struct Home: View {
@@ -17,7 +18,7 @@ struct Home: View {
1718
@State var showProfile = false
1819

1920
var body: some View {
20-
ZStack {
21+
ZStack(alignment: .top) {
2122
HomeList()
2223
.blur(radius: show ? 20 : 0)
2324
.scaleEffect(showProfile ? 0.95 : 1)
@@ -30,12 +31,16 @@ struct Home: View {
3031
.animation(.spring())
3132
.offset(y: showProfile ? statusBarHeight + 40 : UIScreen.main.bounds.height)
3233

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()
3638

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())
3944

4045
MenuView(show: $show)
4146
}
@@ -84,7 +89,7 @@ let menuData = [
8489
Menu(title: "My Account", icon: "person.crop.circle"),
8590
Menu(title: "Settings", icon: "gear"),
8691
Menu(title: "Billing", icon: "creditcard"),
87-
Menu(title: "Team", icon: "person.and.person"),
92+
Menu(title: "Team", icon: "person.2"),
8893
Menu(title: "Sign out", icon: "arrow.uturn.down")
8994
]
9095

@@ -119,7 +124,7 @@ struct MenuView: View {
119124
.rotation3DEffect(Angle(degrees: show ? 0 : 60), axis: (x: 0, y: 10.0, z: 0))
120125
.animation(.default)
121126
.offset(x: show ? 0 : -UIScreen.main.bounds.width)
122-
.tapAction {
127+
.onTapGesture {
123128
self.show.toggle()
124129
}
125130
Spacer()

DesignCode/Settings.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct Settings: View {
3535
})
3636
Section(header: Text("Email")) {
3737
TextField("Your email: ", text: $email)
38-
.textFieldStyle(.roundedBorder)
38+
.textFieldStyle(RoundedBorderTextFieldStyle())
3939
}
4040
Button(action: { self.submit.toggle() }) {
4141
Text("Submit")

DesignCode/TabBar.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import SwiftUI
1010

1111
struct TabBar: View {
1212
var body: some View {
13-
TabbedView {
13+
TabView {
1414
Home().tabItem {
1515
Image("IconHome")
1616
Text("Home")

DesignCode/UpdateList.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import SwiftUI
1111
struct UpdateList: View {
1212

1313
var updates = updateData
14-
@ObjectBinding var store = UpdateStore(updates: updateData)
14+
@ObservedObject var store = UpdateStore(updates: updateData)
1515

1616
func addUpdate() {
1717
store.updates.append(Update(image: "Certificate1", title: "New Title", text: "New Text", date: "JUL 1"))

DesignCode/UpdateStore.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Combine
1010
import SwiftUI
1111

12-
class UpdateStore: BindableObject {
12+
class UpdateStore: ObservableObject {
1313
var willChange = PassthroughSubject<Void, Never>()
1414

1515
var updates: [Update] {

0 commit comments

Comments
 (0)