Skip to content

feat: Removes emptyObject requirement #249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'

gem 'jazzy', '~> 0.13.7'
gem 'jazzy', '~> 0.14.0'
70 changes: 38 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
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)
httpclient (~> 2.8, >= 2.8.3)
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)
Expand All @@ -28,85 +30,89 @@ 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)
xcinvoke (~> 0.3.0)
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)
netrc (0.11.0)
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
]
)
```
Expand Down
17 changes: 0 additions & 17 deletions Sources/ParseSwift/Objects/ParseObject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Sources/ParseSwift/ParseConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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/"
Expand Down
13 changes: 13 additions & 0 deletions Tests/ParseSwiftTests/ParseObjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down