Skip to content

Commit

Permalink
Xcode 11.1 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
moflo committed Oct 13, 2019
1 parent a1f94d7 commit cc06b44
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 31 deletions.
2 changes: 1 addition & 1 deletion SwiftUI-Todo-Redux/states/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Combine
import Foundation
import SwiftUI

final class AppState: BindableObject {
final class AppState: ObservableObject {
var didChange = PassthroughSubject<AppState, Never>()

var usersState: UsersState
Expand Down
2 changes: 1 addition & 1 deletion SwiftUI-Todo-Redux/views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct HomeView: View {

var body: some View {
ZStack(alignment: .bottom) {
TabbedView(selection: self.$selectedTab) {
TabView(selection: self.$selectedTab) {
TasksList().tabItem{ VStack { Image("tab_task"); Text("Tasks") } }.tag(Tab.tasks)
UsersList().tabItem{ VStack { Image("tab_user"); Text("Team") } }.tag(Tab.users)
}
Expand Down
13 changes: 7 additions & 6 deletions SwiftUI-Todo-Redux/views/common/FormButtons.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ struct FieldSetText: View {
VStack(alignment: .leading) {
Text(label)
.font(.headline)
TextField($textItem, placeholder: Text(placeHolder))
TextField(placeHolder, text: $textItem)
.padding(.all)
.background(Color("form-field-background"), cornerRadius: 5.0)
.background(Color("form-field-background")) //, cornerRadius: 5.0)
}
.padding(.horizontal, 15)
}
Expand All @@ -35,12 +35,13 @@ struct RoundedButton: View {
Spacer()
Text("Save")
.font(.headline)
.color(Color.white)
.foregroundColor(Color.white)
Spacer()
}
}
.padding(.vertical, 10.0)
.background(Color.green, cornerRadius: 8.0)
.background(Color.green)
//, cornerRadius: 8.0)
.padding(.horizontal, 40)
}
}
Expand All @@ -54,7 +55,7 @@ struct NotificationBadge: View {

var animation: Animation {
Animation
.spring(initialVelocity: 5)
.spring(dampingFraction: 0.5)
.speed(2)
.delay(0.3)
}
Expand All @@ -69,7 +70,7 @@ struct NotificationBadge: View {
}

return Text(text)
.color(.white)
.foregroundColor(.white)
.padding()
.background(color)
.cornerRadius(8)
Expand Down
4 changes: 2 additions & 2 deletions SwiftUI-Todo-Redux/views/common/KeyboardObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import SwiftUI

// Class to respond to keyboard events

final class KeyboardObserver: BindableObject {
final class KeyboardObserver: ObservableObject {
let didChange = PassthroughSubject<Void, Never>()

public var rects: [CGRect]
Expand All @@ -21,7 +21,7 @@ final class KeyboardObserver: BindableObject {
// this flag makes sure we only act once per keyboard appearance
public var keyboardIsHidden = true

public var slide: Length = 0 {
public var slide: CGFloat = 0.0 {
didSet {
didChange.send()
}
Expand Down
6 changes: 3 additions & 3 deletions SwiftUI-Todo-Redux/views/tasks/TaskDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ struct TaskDetail: View {
var body: some View {
VStack(alignment: .leading, spacing: 20) {
HStack {
if self.mode?.value == .active {
if self.mode?.wrappedValue == .active {
Button(action: {
self.mode?.animation().value = .inactive
self.mode?.animation().wrappedValue = .inactive
// Update current taskID
self.task = self.draftTask
// store.dispatch(aciton: TaskActions.updateTask(id: task.id, task: draftTask))
Expand All @@ -78,7 +78,7 @@ struct TaskDetail: View {

EditButton()
}
if self.mode?.value == .inactive {
if self.mode?.wrappedValue == .inactive {
TaskSummary
} else {
TaskEdit
Expand Down
10 changes: 6 additions & 4 deletions SwiftUI-Todo-Redux/views/tasks/TasksList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ struct TasksList: View {
}
}

var taskCreateModal: Modal {
return Modal(TaskCreate(isEditing: $showEdit).environmentObject(store))
}
// var taskCreateModal: Modal {
// return Modal(TaskCreate(isEditing: $showEdit).environmentObject(store))
// }

var body: some View {
NavigationView {
Expand All @@ -51,7 +51,9 @@ struct TasksList: View {
label: { Text("Add2") }
)
})
.presentation(self.showEdit ? self.taskCreateModal : nil)
.sheet(isPresented: $showEdit) {
TaskCreate(isEditing: self.$showEdit).environmentObject(self.store)
}
.onAppear {
self.loadPage()
}
Expand Down
12 changes: 7 additions & 5 deletions SwiftUI-Todo-Redux/views/tasks/TasksRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ struct TasksRow: View {
HStack {
if task.isDone {
Image(systemName: "checkmark.circle.fill")
.font(.system(size: 60))
// .font(.largeTitle)
.imageScale(.large)
.foregroundColor(.green)
} else {
Image(systemName: "checkmark.circle")
.font(.system(size: 60))
// .font(.largeTitle)
.imageScale(.large)
.foregroundColor(.gray)
}
VStack(alignment: .leading, spacing: 8) {
VStack(alignment: .leading, spacing: CGFloat(8.0)) {
Text(task.title).font(.title)
Text(task.id)
.color(.secondary)
}.padding(.leading, 8)
.foregroundColor(.secondary)
}.padding(.leading, CGFloat(8.0))
}.padding(8)
}
}
Expand Down
6 changes: 3 additions & 3 deletions SwiftUI-Todo-Redux/views/users/UserDetail.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ struct UserDetail: View {
var body: some View {
VStack(alignment: .leading) {
HStack {
if self.mode?.value == .active {
if self.mode?.wrappedValue == .active {
Button(action: {
self.mode?.animation().value = .inactive
self.mode?.animation().wrappedValue = .inactive
// Update current userID
self.user = self.draftUser
// store.dispatch(aciton: UserActions.updateUser(id: user.id, user: draftUser))
Expand All @@ -66,7 +66,7 @@ struct UserDetail: View {

EditButton()
}
if self.mode?.value == .inactive {
if self.mode?.wrappedValue == .inactive {
UserSummary
} else {
UserEdit
Expand Down
10 changes: 6 additions & 4 deletions SwiftUI-Todo-Redux/views/users/UsersList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ struct UsersList: View {
}
}

var taskCreateModal: Modal {
return Modal(UserCreate(isEditing: $showEdit).environmentObject(store))
}
// var taskCreateModal: Modal {
// return Modal(UserCreate(isEditing: $showEdit).environmentObject(store))
// }

var body: some View {
NavigationView {
Expand All @@ -47,7 +47,9 @@ struct UsersList: View {
HStack {
Button(action: { self.showEdit.toggle() }, label: { Text("Add") })
})
.presentation(self.showEdit ? self.taskCreateModal : nil)
.sheet(isPresented: $showEdit) {
UserCreate(isEditing: self.$showEdit).environmentObject(self.store)
}
.onAppear {
self.loadPage()
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftUI-Todo-Redux/views/users/UsersRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ struct UsersRow: View {

var body: some View {
HStack {
VStack(alignment: .leading, spacing: 8) {
VStack(alignment: .leading, spacing: CGFloat(8.0)) {
Text(user.name).font(.title)
Text(user.username)
.color(.secondary)
.foregroundColor(.secondary)
}.padding(.leading, 8)
}.padding(8)
}
Expand Down

0 comments on commit cc06b44

Please sign in to comment.