diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c91a6af0..31269cc35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,15 @@ # Parse-Swift Changelog ### main -[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.10.0...main) +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.10.1...main) * _Contributing to this repo? Add info about your change here to be included in the next release_ +### 1.10.1 +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.10.0...1.10.1) + +__Improvements__ +- Removes emptyObject requirement that was added in #243. Instead, has a recommendation in playgrounds on how to use emptyObject to only send select modified keys to the server ([#249](https://github.com/parse-community/Parse-Swift/pull/249)), thanks to [Corey Baker](https://github.com/cbaker6). + ### 1.10.0 [Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.9.10...1.10.0) diff --git a/Gemfile b/Gemfile index 1c067b827..d7d8948c2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'jazzy', '~> 0.13.7' +gem 'jazzy', '~> 0.14.0' diff --git a/Gemfile.lock b/Gemfile.lock index c4c7e8c64..87ed386c1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,14 @@ GEM remote: https://rubygems.org/ specs: - CFPropertyList (3.0.3) - activesupport (5.2.6) + CFPropertyList (3.0.4) + rexml + activesupport (6.1.4.1) concurrent-ruby (~> 1.0, >= 1.0.2) - i18n (>= 0.7, < 2) - minitest (~> 5.1) - tzinfo (~> 1.1) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + zeitwerk (~> 2.3) addressable (2.8.0) public_suffix (>= 2.0.2, < 5.0) algoliasearch (1.27.5) @@ -14,10 +16,10 @@ GEM json (>= 1.5.1) atomos (0.1.3) claide (1.0.3) - cocoapods (1.10.1) - addressable (~> 2.6) + cocoapods (1.11.2) + addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.10.1) + cocoapods-core (= 1.11.2) cocoapods-deintegrate (>= 1.0.3, < 2.0) cocoapods-downloader (>= 1.4.0, < 2.0) cocoapods-plugins (>= 1.0.0, < 2.0) @@ -28,46 +30,47 @@ GEM escape (~> 0.0.4) fourflusher (>= 2.3.0, < 3.0) gh_inspector (~> 1.0) - molinillo (~> 0.6.6) + molinillo (~> 0.8.0) nap (~> 1.0) - ruby-macho (~> 1.4) - xcodeproj (>= 1.19.0, < 2.0) - cocoapods-core (1.10.1) - activesupport (> 5.0, < 6) - addressable (~> 2.6) + ruby-macho (>= 1.0, < 3.0) + xcodeproj (>= 1.21.0, < 2.0) + cocoapods-core (1.11.2) + activesupport (>= 5.0, < 7) + addressable (~> 2.8) algoliasearch (~> 1.0) concurrent-ruby (~> 1.1) fuzzy_match (~> 2.0.4) nap (~> 1.0) netrc (~> 0.11) - public_suffix + public_suffix (~> 4.0) typhoeus (~> 1.0) - cocoapods-deintegrate (1.0.4) - cocoapods-downloader (1.4.0) + cocoapods-deintegrate (1.0.5) + cocoapods-downloader (1.5.1) cocoapods-plugins (1.0.0) nap - cocoapods-search (1.0.0) - cocoapods-trunk (1.5.0) + cocoapods-search (1.0.1) + cocoapods-trunk (1.6.0) nap (>= 0.8, < 2.0) netrc (~> 0.11) cocoapods-try (1.2.0) colored2 (3.1.2) - concurrent-ruby (1.1.8) + concurrent-ruby (1.1.9) escape (0.0.4) ethon (0.14.0) ffi (>= 1.15.0) - ffi (1.15.0) + ffi (1.15.4) fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) httpclient (2.8.3) i18n (1.8.10) concurrent-ruby (~> 1.0) - jazzy (0.13.7) + jazzy (0.14.0) cocoapods (~> 1.5) mustache (~> 1.1) - open4 + open4 (~> 1.3) redcarpet (~> 3.4) + rexml (~> 3.2) rouge (>= 2.0.6, < 4.0) sassc (~> 2.1) sqlite3 (~> 1.3) @@ -75,7 +78,7 @@ GEM json (2.5.1) liferaft (0.0.6) minitest (5.14.4) - molinillo (0.6.6) + molinillo (0.8.0) mustache (1.1.1) nanaimo (0.3.0) nap (1.1.0) @@ -83,30 +86,33 @@ GEM open4 (1.3.4) public_suffix (4.0.6) redcarpet (3.5.1) - rouge (3.26.0) - ruby-macho (1.4.0) + rexml (3.2.5) + rouge (3.26.1) + ruby-macho (2.5.1) sassc (2.4.0) ffi (~> 1.9) sqlite3 (1.4.2) - thread_safe (0.3.6) typhoeus (1.4.0) ethon (>= 0.9.0) - tzinfo (1.2.9) - thread_safe (~> 0.1) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) xcinvoke (0.3.0) liferaft (~> 0.0.6) - xcodeproj (1.19.0) + xcodeproj (1.21.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) colored2 (~> 3.1) nanaimo (~> 0.3.0) + rexml (~> 3.2.4) + zeitwerk (2.4.2) PLATFORMS ruby + universal-darwin-20 DEPENDENCIES - jazzy (~> 0.13.7) + jazzy (~> 0.14.0) BUNDLED WITH - 2.1.4 + 2.2.2 diff --git a/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift index c3aea56e2..db407d767 100644 --- a/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/1 - Your first Object.xcplaygroundpage/Contents.swift @@ -39,6 +39,20 @@ struct GameScore: ParseObject { //: Your own properties. var score: Int = 0 + + /*: + It's recommended the developer adds the emptyObject computed property or similar. + Gets an empty version of the respective object. This can be used when you only need to update a + a subset of the fields of an object as oppose to updating every field of an object. + - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between + client and server when using `save` and `saveAll` to update objects. + */ + var emptyObject: Self { + var object = Self() + object.objectId = objectId + object.createdAt = createdAt + return object + } } //: It's recommended to place custom initializers in an extension @@ -348,6 +362,7 @@ let points = [ try ParseGeoPoint(latitude: 1, longitude: 0), try ParseGeoPoint(latitude: 0, longitude: 0) ] + do { let polygon = try ParsePolygon(points) let bytes = ParseBytes(data: "hello world".data(using: .utf8)!) diff --git a/ParseSwift.playground/Pages/15 - Custom ObjectId.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/15 - Custom ObjectId.xcplaygroundpage/Contents.swift index 18258b7d6..211771c20 100644 --- a/ParseSwift.playground/Pages/15 - Custom ObjectId.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/15 - Custom ObjectId.xcplaygroundpage/Contents.swift @@ -30,6 +30,20 @@ struct GameScore: ParseObject { //: Your own properties. var score: Int = 0 + + /*: + It's recommended the developer adds the emptyObject computed property or similar. + Gets an empty version of the respective object. This can be used when you only need to update a + a subset of the fields of an object as oppose to updating every field of an object. + - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between + client and server when using `save` and `saveAll` to update objects. + */ + var emptyObject: Self { + var object = Self() + object.objectId = objectId + object.createdAt = createdAt + return object + } } //: It's recommended to place custom initializers in an extension diff --git a/ParseSwift.playground/Pages/4 - User - Continued.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/4 - User - Continued.xcplaygroundpage/Contents.swift index 027558318..107f8e46a 100644 --- a/ParseSwift.playground/Pages/4 - User - Continued.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/4 - User - Continued.xcplaygroundpage/Contents.swift @@ -32,6 +32,20 @@ struct User: ParseUser { var score: GameScore? var targetScore: GameScore? var allScores: [GameScore]? + + /*: + It's recommended the developer adds the emptyObject computed property or similar. + Gets an empty version of the respective object. This can be used when you only need to update a + a subset of the fields of an object as oppose to updating every field of an object. + - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between + client and server when using `save` and `saveAll` to update objects. + */ + var emptyObject: Self { + var object = Self() + object.objectId = objectId + object.createdAt = createdAt + return object + } } //: It's recommended to place custom initializers in an extension diff --git a/ParseSwift.playground/Pages/6 - Installation.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/6 - Installation.xcplaygroundpage/Contents.swift index ea5bb4ab6..e5bffb8dc 100644 --- a/ParseSwift.playground/Pages/6 - Installation.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/6 - Installation.xcplaygroundpage/Contents.swift @@ -35,6 +35,20 @@ struct Installation: ParseInstallation { //: Your custom keys var customKey: String? + + /*: + It's recommended the developer adds the emptyObject computed property or similar. + Gets an empty version of the respective object. This can be used when you only need to update a + a subset of the fields of an object as oppose to updating every field of an object. + - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between + client and server when using `save` and `saveAll` to update objects. + */ + var emptyObject: Self { + var object = Self() + object.objectId = objectId + object.createdAt = createdAt + return object + } } /*: Save your first `customKey` value to your `ParseInstallation`. diff --git a/README.md b/README.md index de9f719d5..30182916c 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.9.10"), + .package(url: "https://github.com/parse-community/Parse-Swift", from: "1.10.1"), ] ) ``` diff --git a/Sources/ParseSwift/Objects/ParseObject.swift b/Sources/ParseSwift/Objects/ParseObject.swift index 1ab0e483d..2c5e60045 100644 --- a/Sources/ParseSwift/Objects/ParseObject.swift +++ b/Sources/ParseSwift/Objects/ParseObject.swift @@ -33,28 +33,11 @@ public protocol ParseObject: Objectable, Hashable, CustomDebugStringConvertible, CustomStringConvertible { - /** - Default initializer of this object. - */ - init() } // MARK: Default Implementations public extension ParseObject { - /** - Gets an empty version of the respective object. This can be used when you only need to update a - a subset of the fields of an object as oppose to updating every field of an object. - - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between - client and server when using `save` and `saveAll` to update objects. - */ - var emptyObject: Self { - var object = Self() - object.objectId = objectId - object.createdAt = createdAt - return object - } - /** Determines if two objects have the same objectId. - parameter as: Object to compare. diff --git a/Sources/ParseSwift/ParseConstants.swift b/Sources/ParseSwift/ParseConstants.swift index aed7969fd..619fdacc2 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 = "1.10.0" + static let version = "1.10.1" static let fileManagementDirectory = "parse/" static let fileManagementPrivateDocumentsDirectory = "Private Documents/" static let fileManagementLibraryDirectory = "Library/" diff --git a/Tests/ParseSwiftTests/ParseObjectTests.swift b/Tests/ParseSwiftTests/ParseObjectTests.swift index 4b2adb58c..72c00509f 100644 --- a/Tests/ParseSwiftTests/ParseObjectTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectTests.swift @@ -55,6 +55,19 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length self.score = score self.player = name } + + /** + Gets an empty version of the respective object. This can be used when you only need to update a + a subset of the fields of an object as oppose to updating every field of an object. + - note: Using an empty object and updating a subset of the fields reduces the amount of data sent between + client and server when using `save` and `saveAll` to update objects. + */ + var emptyObject: Self { + var object = Self() + object.objectId = objectId + object.createdAt = createdAt + return object + } } struct Game: ParseObject {