diff --git a/CHANGELOG.md b/CHANGELOG.md index fa363a8a7..2fab30b27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,18 @@ ### main -[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.1...main) +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.2...main) * _Contributing to this repo? Add info about your change here to be included in the next release_ +### 2.0.2 +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.1...2.0.2) + __Improvements__ - Add static methods for accessing encoders/decoder so developers do not have to create instances to access ([#259](https://github.com/parse-community/Parse-Swift/pull/259)), thanks to [Corey Baker](https://github.com/cbaker6). +__Fixes__ +- Parse ViewModels always dispatch to the main queue when updating published properties. This prevents possible issues when background async calls update properties used for views ([#260](https://github.com/parse-community/Parse-Swift/pull/260)), thanks to [Corey Baker](https://github.com/cbaker6). + ### 2.0.1 [Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.0...2.0.1) diff --git a/README.md b/README.md index d24a8b5e6..d76ffa718 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ import PackageDescription let package = Package( name: "YOUR_PROJECT_NAME", dependencies: [ - .package(url: "https://github.com/parse-community/Parse-Swift", from: "1.10.1"), + .package(url: "https://github.com/parse-community/Parse-Swift", from: "2.0.2"), ] ) ``` diff --git a/Sources/ParseSwift/LiveQuery/Subscription.swift b/Sources/ParseSwift/LiveQuery/Subscription.swift index a0acbb8d9..7a8d61e07 100644 --- a/Sources/ParseSwift/LiveQuery/Subscription.swift +++ b/Sources/ParseSwift/LiveQuery/Subscription.swift @@ -70,7 +70,9 @@ open class Subscription: QueryViewModel, QuerySubscribable { if newValue != nil { subscribed = nil unsubscribed = nil - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } @@ -81,7 +83,9 @@ open class Subscription: QueryViewModel, QuerySubscribable { if newValue != nil { unsubscribed = nil event = nil - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } @@ -92,7 +96,9 @@ open class Subscription: QueryViewModel, QuerySubscribable { if newValue != nil { subscribed = nil event = nil - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } diff --git a/Sources/ParseSwift/ParseConstants.swift b/Sources/ParseSwift/ParseConstants.swift index 9f442ab96..e05211aae 100644 --- a/Sources/ParseSwift/ParseConstants.swift +++ b/Sources/ParseSwift/ParseConstants.swift @@ -10,7 +10,7 @@ import Foundation enum ParseConstants { static let sdk = "swift" - static let version = "2.0.1" + static let version = "2.0.2" static let fileManagementDirectory = "parse/" static let fileManagementPrivateDocumentsDirectory = "Private Documents/" static let fileManagementLibraryDirectory = "Library/" diff --git a/Sources/ParseSwift/Types/CloudViewModel.swift b/Sources/ParseSwift/Types/CloudViewModel.swift index c6515c50c..5607c7d19 100644 --- a/Sources/ParseSwift/Types/CloudViewModel.swift +++ b/Sources/ParseSwift/Types/CloudViewModel.swift @@ -22,7 +22,9 @@ open class CloudViewModel: CloudObservable { willSet { if newValue != nil { self.error = nil - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } @@ -32,7 +34,9 @@ open class CloudViewModel: CloudObservable { willSet { if newValue != nil { self.results = nil - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } diff --git a/Sources/ParseSwift/Types/QueryViewModel.swift b/Sources/ParseSwift/Types/QueryViewModel.swift index b52b92e7c..c2b57acb1 100644 --- a/Sources/ParseSwift/Types/QueryViewModel.swift +++ b/Sources/ParseSwift/Types/QueryViewModel.swift @@ -22,7 +22,9 @@ open class QueryViewModel: QueryObservable { open var results = [Object]() { willSet { count = newValue.count - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } @@ -31,7 +33,9 @@ open class QueryViewModel: QueryObservable { willSet { error = nil if newValue != results.count { - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } } @@ -42,7 +46,9 @@ open class QueryViewModel: QueryObservable { if newValue != nil { results.removeAll() count = results.count - objectWillChange.send() + DispatchQueue.main.async { + self.objectWillChange.send() + } } } }