Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swift 5.1 and Xcode 11 fixes #3

Merged
merged 4 commits into from
Nov 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DesignCode/ContentView.swift
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ struct ContentView: View {
.scaleEffect(0.95)
.rotationEffect(Angle(degrees: show ? 5 : 0))
.animation(.spring())
.tapAction {
.onTapGesture {
self.show.toggle()
}
.gesture(
23 changes: 14 additions & 9 deletions DesignCode/Home.swift
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@

import SwiftUI

let statusBarHeight = UIApplication.shared.statusBarFrame.height
let window = UIApplication.shared.windows.filter {$0.isKeyWindow}.first
let statusBarHeight = window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
let screen = UIScreen.main.bounds

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

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

MenuButton(show: $show)
.offset(x: -40, y: showProfile ? statusBarHeight : 80)
.animation(.spring())
HStack {
MenuButton(show: $show)
.offset(x: -40)
Spacer()

MenuRight(show: $showProfile)
.offset(x: -16, y: showProfile ? statusBarHeight : 88)
MenuRight(show: $showProfile)
.offset(x: -16)
}
.offset(y: showProfile ? statusBarHeight : 80)
.animation(.spring())

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

@@ -119,7 +124,7 @@ struct MenuView: View {
.rotation3DEffect(Angle(degrees: show ? 0 : 60), axis: (x: 0, y: 10.0, z: 0))
.animation(.default)
.offset(x: show ? 0 : -UIScreen.main.bounds.width)
.tapAction {
.onTapGesture {
self.show.toggle()
}
Spacer()
2 changes: 1 addition & 1 deletion DesignCode/Settings.swift
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ struct Settings: View {
})
Section(header: Text("Email")) {
TextField("Your email: ", text: $email)
.textFieldStyle(.roundedBorder)
.textFieldStyle(RoundedBorderTextFieldStyle())
}
Button(action: { self.submit.toggle() }) {
Text("Submit")
2 changes: 1 addition & 1 deletion DesignCode/TabBar.swift
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import SwiftUI

struct TabBar: View {
var body: some View {
TabbedView {
TabView {
Home().tabItem {
Image("IconHome")
Text("Home")
2 changes: 1 addition & 1 deletion DesignCode/UpdateList.swift
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ import SwiftUI
struct UpdateList: View {

var updates = updateData
@ObjectBinding var store = UpdateStore(updates: updateData)
@ObservedObject var store = UpdateStore(updates: updateData)

func addUpdate() {
store.updates.append(Update(image: "Certificate1", title: "New Title", text: "New Text", date: "JUL 1"))
2 changes: 1 addition & 1 deletion DesignCode/UpdateStore.swift
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
import Combine
import SwiftUI

class UpdateStore: BindableObject {
class UpdateStore: ObservableObject {
var willChange = PassthroughSubject<Void, Never>()

var updates: [Update] {