Xcode 11 beta 6

This commit is contained in:
John Holdsworth
2019-08-20 18:54:37 +02:00
parent a36ff1b7ca
commit 7de7e1e47b
40 changed files with 114 additions and 115 deletions

View File

@@ -10,8 +10,8 @@ import Foundation
import SwiftUI
import Combine
final class AppState: BindableObject {
var willChange = PassthroughSubject<AppState, Never>()
final class AppState: ObservableObject {
var objectWillChange = PassthroughSubject<AppState, Never>()
var usersState: UsersState
@@ -21,7 +21,7 @@ final class AppState: BindableObject {
func dispatch(action: Action) {
usersState = UserStateReducer().reduce(state: usersState, action: action)
willChange.send(self)
objectWillChange.send(self)
}
}

View File

@@ -13,7 +13,7 @@ struct TabbarView : View {
@State var selectedIndex: Int = 0
var body: some View {
TabbedView(selection: $selectedIndex) {
TabView(selection: $selectedIndex) {
UsersListView()
.tabItem({ Text("Users") })
MapView()

View File

@@ -25,12 +25,12 @@
VStack(alignment: .leading, spacing: 10) {
Text("User name")
TextField("New name", text: $newUserName)
.textFieldStyle(.roundedBorder)
.textFieldStyle(RoundedBorderTextFieldStyle())
Divider()
Text("Username")
TextField("New username", text: $newUserUsername)
.textFieldStyle(.roundedBorder)
}.padding(16)
.textFieldStyle(RoundedBorderTextFieldStyle())
}.padding(16)
Button(action: save) {
Text("Save")
.padding(8)
@@ -42,7 +42,7 @@
Text("Close")
})
.navigationBarTitle(Text("Edit \(user.name)"), displayMode: .inline)
Badge(text: "Saved successfully", color: .green, show: $showSaved)
Badge(text: "Missing username or name", color: .red, show: $showError)
}

View File

@@ -33,7 +33,7 @@ struct UsersListView : View {
.onMove(perform: move)
}
}
.listStyle(.grouped)
.listStyle(GroupedListStyle())
.navigationBarTitle(Text("Users (\(state.usersState.users.count))"))
.navigationBarItems(trailing: EditButton())
}