diff --git a/Other Projects/2048 Game/SwiftUI2048/Models/GameLogic.swift b/Other Projects/2048 Game/SwiftUI2048/Models/GameLogic.swift index c1fb464..ae5ad1b 100755 --- a/Other Projects/2048 Game/SwiftUI2048/Models/GameLogic.swift +++ b/Other Projects/2048 Game/SwiftUI2048/Models/GameLogic.swift @@ -10,7 +10,7 @@ import Foundation import SwiftUI import Combine -final class GameLogic : BindableObject { +final class GameLogic : ObservableObject { enum Direction { case left @@ -21,7 +21,7 @@ final class GameLogic : BindableObject { typealias BlockMatrixType = BlockMatrix - let willChange = PassthroughSubject() + let objectWillChange = PassthroughSubject() fileprivate var _blockMatrix: BlockMatrixType! var blockMatrix: BlockMatrixType { @@ -42,12 +42,12 @@ final class GameLogic : BindableObject { _blockMatrix = BlockMatrixType() generateNewBlocks() - willChange.send(self) + objectWillChange.send(self) } func move(_ direction: Direction) { defer { - willChange.send(self) + objectWillChange.send(self) } var moved = false @@ -136,7 +136,7 @@ final class GameLogic : BindableObject { // Don't forget to sync data. defer { - willChange.send(self) + objectWillChange.send(self) } // Place the first block. diff --git a/Other Projects/2048 Game/SwiftUI2048/Views/BlockGridView.swift b/Other Projects/2048 Game/SwiftUI2048/Views/BlockGridView.swift index 50be395..d09e3b8 100755 --- a/Other Projects/2048 Game/SwiftUI2048/Views/BlockGridView.swift +++ b/Other Projects/2048 Game/SwiftUI2048/Views/BlockGridView.swift @@ -77,7 +77,7 @@ struct BlockGridView : View { y: CGFloat(block.index.1) * (65 + 12) + 32.5 + 12) .zIndex(self.zIndex(block.item)) .transition(.blockAppear(from: self.blockEnterEdge)) - .animation(block.item == nil ? nil : .spring(mass: 1, stiffness: 400, damping: 56, initialVelocity: 0)) +// .animation(block.item == nil ? nil : .spring(mass: 1, stiffness: 400, damping: 56, initialVelocity: 0)) } } .frame(width: 320, height: 320, alignment: .center) diff --git a/Other Projects/Animating Views And Transitions/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Animating Views And Transitions/Complete/Landmarks/Landmarks/Models/UserData.swift index 2fcfc3a..efe0bee 100755 --- a/Other Projects/Animating Views And Transitions/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Animating Views And Transitions/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,18 +8,18 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Calculator/Calculator/Calculator/Calculator.swift b/Other Projects/Calculator/Calculator/Calculator/Calculator.swift index fb35a67..378bd75 100755 --- a/Other Projects/Calculator/Calculator/Calculator/Calculator.swift +++ b/Other Projects/Calculator/Calculator/Calculator/Calculator.swift @@ -42,7 +42,7 @@ struct Calculator: View { .foregroundColor(Color.blue) .frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity) .background(Color(red: 234 / 255.0, green: 240 / 255.0, blue: 241 / 255.0)) - .tapAction { + .onTapGesture { self.touchAction(item) } } diff --git a/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserView.swift b/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserView.swift index 8ae5044..b86319f 100755 --- a/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserView.swift +++ b/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserView.swift @@ -13,7 +13,7 @@ struct SearchUserView: View { List(viewModel.users) { user in SearchUserRow(user: user) - .tapAction { print(user) } + .onTapGesture { print(user) } } } .navigationBarTitle(Text("Users")) diff --git a/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserViewModel.swift b/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserViewModel.swift index b8b07b9..f1df886 100755 --- a/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserViewModel.swift +++ b/Other Projects/Combine using GitHub API/SwiftUI-Combine-Example/SearchUserViewModel.swift @@ -1,18 +1,18 @@ import SwiftUI import Combine -final class SearchUserViewModel: BindableObject { - var willChange = PassthroughSubject() +final class SearchUserViewModel: ObservableObject { + var objectWillChange = PassthroughSubject() private(set) var users = [User]() { didSet { - willChange.send(self) + objectWillChange.send(self) } } private(set) var userImages = [User: UIImage]() { didSet { - willChange.send(self) + objectWillChange.send(self) } } diff --git a/Other Projects/Composing Complex Interfaces/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Composing Complex Interfaces/Complete/Landmarks/Landmarks/Models/UserData.swift index 2fcfc3a..efe0bee 100755 --- a/Other Projects/Composing Complex Interfaces/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Composing Complex Interfaces/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,18 +8,18 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/ConverterView.swift b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/ConverterView.swift index 22e3069..a393e50 100644 --- a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/ConverterView.swift +++ b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/ConverterView.swift @@ -34,7 +34,7 @@ struct ConverterView : View { var body: some View { let inset = EdgeInsets(top: -8, leading: -20, bottom: -7, trailing: 5) - let doubleValue: Double = Double(self.$baseAmount.value) ?? 1.0 + let doubleValue: Double = Double(self.$baseAmount.wrappedValue) ?? 1.0 return ZStack(alignment: Alignment.bottomTrailing) { NavigationView { @@ -56,7 +56,7 @@ struct ConverterView : View { .background( RoundedRectangle(cornerRadius: 5) .fill(Color.clear) - .border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 5) + .background(RoundedRectangle(cornerRadius: 5).strokeBorder(Color(red: 0.7, green: 0.7, blue: 0.7), lineWidth: 1 / UIScreen.main.scale)) .padding(inset) ) }.background(Color.blue).cornerRadius(5) @@ -64,7 +64,7 @@ struct ConverterView : View { List { // TODO: should filter out BaseCurrency from list ForEach(userData.userCurrency) { currency in - CurrencyItemView(currency: currency, baseAmount: doubleValue, isEditing: self.$isEditing).tapAction { + CurrencyItemView(currency: currency, baseAmount: doubleValue, isEditing: self.$isEditing).onTapGesture { // Swap this and base self.userData.baseCurrency = currency } @@ -89,7 +89,7 @@ struct ConverterView : View { .background( RoundedRectangle(cornerRadius: 23) .fill(Color.blue) - .border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 23)) + .background(RoundedRectangle(cornerRadius: 23).strokeBorder(Color(red: 0.7, green: 0.7, blue: 0.7), lineWidth: 1 / UIScreen.main.scale))) .foregroundColor(.white).font(.largeTitle) }.padding() } diff --git a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/CurrencyItemView.swift b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/CurrencyItemView.swift index 9b68d98..8e75c62 100644 --- a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/CurrencyItemView.swift +++ b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/CurrencyItemView.swift @@ -42,7 +42,7 @@ struct CurrencyItemView: View { HStack(alignment: .center){ Image(systemName: "minus.circle") .foregroundColor(.red) - .tapAction(count: 1) { + .onTapGesture(count: 1) { self.delete() } diff --git a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/UserData.swift b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/UserData.swift index 3236cbc..dff2da2 100644 --- a/Other Projects/Currency-SwiftUI/Currency-SwiftUI/UserData.swift +++ b/Other Projects/Currency-SwiftUI/Currency-SwiftUI/UserData.swift @@ -51,27 +51,27 @@ struct UserDefaultValue { } } -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() @UserDefaultValue(key: "allCurrencies", defaultValue: defaultCurrencies) var allCurrencies: [Currency] { didSet { - willChange.send(self) + objectWillChange.send(self) } } @UserDefaultValue(key: "baseCurrency", defaultValue: defaultCurrencies[0]) var baseCurrency: Currency { didSet { - willChange.send(self) + objectWillChange.send(self) } } @UserDefaultValue(key: "userCurrency", defaultValue: defaultCurrencies) var userCurrency: [Currency] { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Drawing Paths And Shapes/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Drawing Paths And Shapes/Complete/Landmarks/Landmarks/Models/UserData.swift index 2fcfc3a..efe0bee 100755 --- a/Other Projects/Drawing Paths And Shapes/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Drawing Paths And Shapes/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,18 +8,18 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Example To-Do App/SwiftUITodo/TaskEditView.swift b/Other Projects/Example To-Do App/SwiftUITodo/TaskEditView.swift index 7561526..e074c47 100755 --- a/Other Projects/Example To-Do App/SwiftUITodo/TaskEditView.swift +++ b/Other Projects/Example To-Do App/SwiftUITodo/TaskEditView.swift @@ -22,14 +22,14 @@ struct TaskEditView: View { let inset = EdgeInsets(top: -8, leading: -10, bottom: -7, trailing: -10) return VStack(alignment: .leading, spacing: 0) { TextField( - "Enter New Title...", text: self.draftTitle.binding, + "Enter New Title...", text: self.draftTitle.projectedValue, onEditingChanged: { _ in self.updateTask() }, onCommit: {} ) .background( RoundedRectangle(cornerRadius: 5) .fill(Color.clear) - .border(Color(red: 0.7, green: 0.7, blue: 0.7), width: 1 / UIScreen.main.scale, cornerRadius: 5) + .background(RoundedRectangle(cornerRadius: 5).strokeBorder(Color(red: 0.7, green: 0.7, blue: 0.7), lineWidth: 1 / UIScreen.main.scale)) .padding(inset) ) .padding(EdgeInsets( @@ -46,6 +46,6 @@ struct TaskEditView: View { private func updateTask() { guard let index = self.userData.tasks.firstIndex(of: self.task) else { return } - self.userData.tasks[index].title = self.draftTitle.value + self.userData.tasks[index].title = self.draftTitle.wrappedValue } } diff --git a/Other Projects/Example To-Do App/SwiftUITodo/TaskItemView.swift b/Other Projects/Example To-Do App/SwiftUITodo/TaskItemView.swift index 90eb9b2..c3e4cf6 100755 --- a/Other Projects/Example To-Do App/SwiftUITodo/TaskItemView.swift +++ b/Other Projects/Example To-Do App/SwiftUITodo/TaskItemView.swift @@ -19,7 +19,7 @@ struct TaskItemView: View { if self.isEditing { Image(systemName: "minus.circle") .foregroundColor(.red) - .tapAction(count: 1) { + .onTapGesture(count: 1) { self.delete() } NavigationLink(destination: TaskEditView(task: task).environmentObject(self.userData)) { diff --git a/Other Projects/Example To-Do App/SwiftUITodo/UserData.swift b/Other Projects/Example To-Do App/SwiftUITodo/UserData.swift index ee95b21..270f2c6 100755 --- a/Other Projects/Example To-Do App/SwiftUITodo/UserData.swift +++ b/Other Projects/Example To-Do App/SwiftUITodo/UserData.swift @@ -14,13 +14,13 @@ private let defaultTasks: [Task] = [ Task(title: "Watch WWDC19 Keynote 🎉", isDone: true), ] -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() @UserDefaultValue(key: "Tasks", defaultValue: defaultTasks) var tasks: [Task] { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Flux/SwiftUI-Flux/Store.swift b/Other Projects/Flux/SwiftUI-Flux/Store.swift index ed67948..648e280 100755 --- a/Other Projects/Flux/SwiftUI-Flux/Store.swift +++ b/Other Projects/Flux/SwiftUI-Flux/Store.swift @@ -1,10 +1,10 @@ import SwiftUI import Combine -final class Store: BindableObject { +final class Store: ObservableObject { typealias Reducer = (State, Action) -> State - let willChange = PassthroughSubject() + let objectWillChange = PassthroughSubject() var state: State { lock.lock() @@ -29,6 +29,6 @@ final class Store: BindableObject { lock.unlock() - willChange.send(newState) + objectWillChange.send(newState) } } diff --git a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/Extension/JSONDecoder.Extension.swift b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/Extension/JSONDecoder.Extension.swift index 98200e5..47ade8e 100755 --- a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/Extension/JSONDecoder.Extension.swift +++ b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/Extension/JSONDecoder.Extension.swift @@ -9,4 +9,5 @@ import Combine import Foundation -extension JSONDecoder: TopLevelDecoder {} +// now in Foundation +//extension JSONDecoder: TopLevelDecoder {} diff --git a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListView.swift b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListView.swift index bd26fea..bc08f05 100755 --- a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListView.swift +++ b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListView.swift @@ -10,7 +10,7 @@ import SwiftUI struct RepositoryListView : View { - @ObjectBinding + @ObservedObject private(set) var viewModel: RepositoryListViewModel var body: some View { @@ -24,15 +24,15 @@ struct RepositoryListView : View { onCommit: { self.viewModel.search() }) .frame(height: 40) .padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8)) - .border(Color.gray, cornerRadius: 8) .padding(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) + .background(RoundedRectangle(cornerRadius: 8).strokeBorder(Color.gray, lineWidth: 2)) Button(action: { self.viewModel.search() }) { Text("Search") } .frame(height: 40) .padding(EdgeInsets(top: 0, leading: 8, bottom: 0, trailing: 8)) - .border(Color.blue, cornerRadius: 8) + .background(RoundedRectangle(cornerRadius: 8).strokeBorder(Color.blue, lineWidth: 2)) .padding(EdgeInsets(top: 0, leading: 0, bottom: 0, trailing: 16)) } diff --git a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListViewModel.swift b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListViewModel.swift index 403a8f6..d783198 100755 --- a/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListViewModel.swift +++ b/Other Projects/GitHub Search/GitHubSearchWithSwiftUI/View/RepositoryListViewModel.swift @@ -10,10 +10,10 @@ import Combine import Foundation import SwiftUI -final class RepositoryListViewModel: BindableObject { +final class RepositoryListViewModel: ObservableObject { typealias SearchRepositories = (String) -> AnyPublisher, Never> - let willChange: AnyPublisher + let objectWillChange: AnyPublisher private let _didChange = PassthroughSubject() private let _searchWithQuery = PassthroughSubject() @@ -34,7 +34,7 @@ final class RepositoryListViewModel: BindableObject { init(searchRepositories: @escaping SearchRepositories = RepositoryAPI.search, mainScheduler: S) { - self.willChange = _didChange.eraseToAnyPublisher() + self.objectWillChange = _didChange.eraseToAnyPublisher() let response = _searchWithQuery .filter { !$0.isEmpty } diff --git a/Other Projects/Handling User Input/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Handling User Input/Complete/Landmarks/Landmarks/Models/UserData.swift index 2fcfc3a..efe0bee 100755 --- a/Other Projects/Handling User Input/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Handling User Input/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,18 +8,18 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/HikeBadge.swift b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/HikeBadge.swift index 78e9ad3..52716cf 100755 --- a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/HikeBadge.swift +++ b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/HikeBadge.swift @@ -11,11 +11,10 @@ struct HikeBadge: View { var name: String var body: some View { VStack(alignment: .center) { -// crashes in Beta 5 -// Badge() -// .frame(width: 300, height: 300) -// .scaleEffect(1.0 / 3.0) -// .frame(width: 100, height: 100) + Badge() + .frame(width: 300, height: 300) + .scaleEffect(1.0 / 3.0) + .frame(width: 100, height: 100) Text(name) .font(.caption) .accessibility(label: Text("Badge for \(name).")) diff --git a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Models/UserData.swift index 2fcfc3a..efe0bee 100755 --- a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,18 +8,18 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift index dde2cdd..8fb3e81 100755 --- a/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift +++ b/Other Projects/Interfacing With UIKit/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift @@ -15,10 +15,10 @@ struct ProfileHost: View { var body: some View { VStack(alignment: .leading, spacing: 20) { HStack { - if self.mode?.value == .active { + if self.mode?.wrappedValue == .active { Button(action: { self.draftProfile = self.profile - self.mode?.animation().value = .inactive + self.mode?.animation().wrappedValue = .inactive }) { Text("Done") } @@ -28,7 +28,7 @@ struct ProfileHost: View { EditButton() } - if self.mode?.value == .inactive { + if self.mode?.wrappedValue == .inactive { ProfileSummary(profile: profile) } else { ProfileEditor(profile: $draftProfile) diff --git a/Other Projects/Jike/SwiftUI_Jike/Cell/CategoryRow.swift b/Other Projects/Jike/SwiftUI_Jike/Cell/CategoryRow.swift index c0c16fd..4860dab 100755 --- a/Other Projects/Jike/SwiftUI_Jike/Cell/CategoryRow.swift +++ b/Other Projects/Jike/SwiftUI_Jike/Cell/CategoryRow.swift @@ -31,7 +31,7 @@ struct CategoryItem: View { VStack{ Color.white .frame(width:65,height:65) - .border(Color(red: 218.0/255.0, green: 218.0/255.0, blue: 218.0/255.0),width: 3,cornerRadius: 15) + .background(RoundedRectangle(cornerRadius: 15).strokeBorder(Color(red: 218.0/255.0, green: 218.0/255.0, blue: 218.0/255.0), lineWidth: 3)) .cornerRadius(15) zone .image(forSize: 55) diff --git a/Other Projects/Movie/MovieSwift/MovieSwift/flux/state/AppState.swift b/Other Projects/Movie/MovieSwift/MovieSwift/flux/state/AppState.swift index 3dfa453..9322ffa 100755 --- a/Other Projects/Movie/MovieSwift/MovieSwift/flux/state/AppState.swift +++ b/Other Projects/Movie/MovieSwift/MovieSwift/flux/state/AppState.swift @@ -10,8 +10,8 @@ import Foundation import SwiftUI import Combine -final class AppState: BindableObject { - var willChange = PassthroughSubject() +final class AppState: ObservableObject { + var objectWillChange = PassthroughSubject() var moviesState: MoviesState @@ -22,7 +22,7 @@ final class AppState: BindableObject { func dispatch(action: Action) { moviesState = MoviesStateReducer().reduce(state: moviesState, action: action) DispatchQueue.main.async { - self.willChange.send(self) + self.objectWillChange.send(self) } } } diff --git a/Other Projects/SwiftUI + Redux/SwiftUIDemo/flux/states/AppState.swift b/Other Projects/SwiftUI + Redux/SwiftUIDemo/flux/states/AppState.swift index 48c5f04..067ccce 100755 --- a/Other Projects/SwiftUI + Redux/SwiftUIDemo/flux/states/AppState.swift +++ b/Other Projects/SwiftUI + Redux/SwiftUIDemo/flux/states/AppState.swift @@ -10,8 +10,8 @@ import Foundation import SwiftUI import Combine -final class AppState: BindableObject { - var willChange = PassthroughSubject() +final class AppState: ObservableObject { + var objectWillChange = PassthroughSubject() 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) } } diff --git a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/TabbarView.swift b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/TabbarView.swift index ff9e9e6..8e2c1f8 100755 --- a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/TabbarView.swift +++ b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/TabbarView.swift @@ -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() diff --git a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UserEditForm.swift b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UserEditForm.swift index c10244e..5283b22 100755 --- a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UserEditForm.swift +++ b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UserEditForm.swift @@ -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) } diff --git a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UsersListView.swift b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UsersListView.swift index 841d829..460afe8 100755 --- a/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UsersListView.swift +++ b/Other Projects/SwiftUI + Redux/SwiftUIDemo/views/users/UsersListView.swift @@ -33,7 +33,7 @@ struct UsersListView : View { .onMove(perform: move) } } - .listStyle(.grouped) + .listStyle(GroupedListStyle()) .navigationBarTitle(Text("Users (\(state.usersState.users.count))")) .navigationBarItems(trailing: EditButton()) } diff --git a/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/Store.swift b/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/Store.swift index c2bb509..d549942 100755 --- a/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/Store.swift +++ b/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/Store.swift @@ -1,12 +1,12 @@ import SwiftUI import Combine -public final class Store: BindableObject where StateType: StateMachine { +public final class Store: ObservableObject where StateType: StateMachine { private let initialState: StateType private var subsequentStates: [StateType] = [] - public let willChange = PassthroughSubject() + public let objectWillChange = PassthroughSubject() public init(state: StateType) { initialState = state @@ -23,7 +23,7 @@ public final class Store: BindableObject where StateType: StateMachin var currentStateIndex: Int = 0 { didSet { withAnimation { - willChange.send(()) + objectWillChange.send(()) } } } diff --git a/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/TimeTravelBarView.swift b/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/TimeTravelBarView.swift index 22edc95..fb568c8 100755 --- a/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/TimeTravelBarView.swift +++ b/Other Projects/Time Travel/SwiftUITimeTravel/TimeTravelView/TimeTravelBarView.swift @@ -5,9 +5,9 @@ struct TimeTravelBarView : View { @EnvironmentObject var store: Store var body: some View { - let indexBinding = Binding( - getValue: { Double(self.store.currentStateIndex) }, - setValue: { self.store.currentStateIndex = Int($0) }) + let indexBinding = Binding( + get: { Double(self.store.currentStateIndex) }, + set: { self.store.currentStateIndex = Int($0) }) return Slider(value: indexBinding, in: 0...Double(store.stateCount-1)) .background(Color.white) diff --git a/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/AddItemView.swift b/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/AddItemView.swift index ce5f5c7..f9dfe2f 100755 --- a/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/AddItemView.swift +++ b/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/AddItemView.swift @@ -6,9 +6,9 @@ struct AddItemView: View { var body: some View { - let textBinding = Binding( - getValue: { self.store.state.partialItemName }, - setValue: { self.store.dispatch(event: .changePartialItemName($0)) }) + let textBinding = Binding( + get: { self.store.state.partialItemName }, + set: { self.store.dispatch(event: .changePartialItemName($0)) }) return VStack(spacing: 16) { TextField("Title", text: textBinding) diff --git a/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/ModalDimmingView.swift b/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/ModalDimmingView.swift index 5c0f814..5c165f4 100755 --- a/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/ModalDimmingView.swift +++ b/Other Projects/Time Travel/SwiftUITimeTravel/TodoList/Internal Views/ModalDimmingView.swift @@ -12,7 +12,7 @@ struct ModalDimmingView : View { .opacity(0.3) .edgesIgnoringSafeArea([.bottom, .top]) .transition(.opacity) - .tapAction { + .onTapGesture { self.store.dispatch(event: .cancelCreatingItem) } } diff --git a/Other Projects/UINote/SwiftUINote/Models/UserData.swift b/Other Projects/UINote/SwiftUINote/Models/UserData.swift index 5033cf2..963481d 100755 --- a/Other Projects/UINote/SwiftUINote/Models/UserData.swift +++ b/Other Projects/UINote/SwiftUINote/Models/UserData.swift @@ -9,12 +9,12 @@ import SwiftUI import Combine -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var notes = NoteData.shared.notes { didSet { - willChange.send(self) + objectWillChange.send(self) NoteData.shared.notes = notes } } diff --git a/Other Projects/UINote/SwiftUINote/Views/NoteDetail.swift b/Other Projects/UINote/SwiftUINote/Views/NoteDetail.swift index 52ebc28..b3dca9b 100755 --- a/Other Projects/UINote/SwiftUINote/Views/NoteDetail.swift +++ b/Other Projects/UINote/SwiftUINote/Views/NoteDetail.swift @@ -24,7 +24,7 @@ struct NoteDetail : View { var body: some View { VStack { - TextField("", text: self.text.binding, + TextField("", text: self.text.projectedValue, onEditingChanged: { _ in self.updateNote()}, onCommit: {}) Spacer() @@ -35,7 +35,7 @@ struct NoteDetail : View { } private func updateNote() { - self.userData.notes[noteIndex].text = self.text.value + self.userData.notes[noteIndex].text = self.text.wrappedValue } } diff --git a/Other Projects/WWDCPlayer/WWDCPlayer/MainView.swift b/Other Projects/WWDCPlayer/WWDCPlayer/MainView.swift index 2f0512a..98ab22c 100755 --- a/Other Projects/WWDCPlayer/WWDCPlayer/MainView.swift +++ b/Other Projects/WWDCPlayer/WWDCPlayer/MainView.swift @@ -67,6 +67,6 @@ struct VideoListView : View { } } } - }.listStyle(.grouped) + }.listStyle(GroupedListStyle()) } } diff --git a/Other Projects/WWDCPlayer/WWDCPlayer/Model/UserData.swift b/Other Projects/WWDCPlayer/WWDCPlayer/Model/UserData.swift index 76c8a20..5a42bdb 100755 --- a/Other Projects/WWDCPlayer/WWDCPlayer/Model/UserData.swift +++ b/Other Projects/WWDCPlayer/WWDCPlayer/Model/UserData.swift @@ -8,24 +8,24 @@ import SwiftUI import Combine -final class UserData: BindableObject { - let willChange = PassthroughSubject() +final class UserData: ObservableObject { + let objectWillChange = PassthroughSubject() var showFavoriteOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var videos = videoList { didSet { - willChange.send(self) + objectWillChange.send(self) } } var currentVideo = videoList[0] { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/WWDCPlayer/WWDCPlayer/VideoRow.swift b/Other Projects/WWDCPlayer/WWDCPlayer/VideoRow.swift index cf3b72f..d5bb65d 100755 --- a/Other Projects/WWDCPlayer/WWDCPlayer/VideoRow.swift +++ b/Other Projects/WWDCPlayer/WWDCPlayer/VideoRow.swift @@ -32,13 +32,13 @@ struct VideoRow : View { Image(systemName: video.isFavorite ? "star.fill" : "star") .foregroundColor(video.isFavorite ? Color.yellow : Color.gray) - .tapAction { + .onTapGesture { self.setFavorite(video: self.video) } } } .padding([.top, .bottom], 10) - .tapAction { + .onTapGesture { self.setCurrentVideo(video: self.video) } } diff --git a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/HikeBadge.swift b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/HikeBadge.swift index 78e9ad3..52716cf 100755 --- a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/HikeBadge.swift +++ b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/HikeBadge.swift @@ -11,11 +11,10 @@ struct HikeBadge: View { var name: String var body: some View { VStack(alignment: .center) { -// crashes in Beta 5 -// Badge() -// .frame(width: 300, height: 300) -// .scaleEffect(1.0 / 3.0) -// .frame(width: 100, height: 100) + Badge() + .frame(width: 300, height: 300) + .scaleEffect(1.0 / 3.0) + .frame(width: 100, height: 100) Text(name) .font(.caption) .accessibility(label: Text("Badge for \(name).")) diff --git a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Models/UserData.swift b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Models/UserData.swift index 8d6fc5c..2a54838 100755 --- a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Models/UserData.swift +++ b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Models/UserData.swift @@ -8,19 +8,19 @@ A model object that stores app data. import Combine import SwiftUI -final class UserData: BindableObject { +final class UserData: ObservableObject { - let willChange = PassthroughSubject() + let objectWillChange = PassthroughSubject() var showFavoritesOnly = false { didSet { - willChange.send(self) + objectWillChange.send(self) } } var landmarks = landmarkData { didSet { - willChange.send(self) + objectWillChange.send(self) } } } diff --git a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift index dde2cdd..8fb3e81 100755 --- a/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift +++ b/Other Projects/Working With UIControls/Complete/Landmarks/Landmarks/Profiles/ProfileHost.swift @@ -15,10 +15,10 @@ struct ProfileHost: View { var body: some View { VStack(alignment: .leading, spacing: 20) { HStack { - if self.mode?.value == .active { + if self.mode?.wrappedValue == .active { Button(action: { self.draftProfile = self.profile - self.mode?.animation().value = .inactive + self.mode?.animation().wrappedValue = .inactive }) { Text("Done") } @@ -28,7 +28,7 @@ struct ProfileHost: View { EditButton() } - if self.mode?.value == .inactive { + if self.mode?.wrappedValue == .inactive { ProfileSummary(profile: profile) } else { ProfileEditor(profile: $draftProfile)