diff --git a/Package.swift b/Package.swift
index 186d28bb5..1db075989 100644
--- a/Package.swift
+++ b/Package.swift
@@ -1,4 +1,4 @@
-// swift-tools-version:5.0
+// swift-tools-version:5.1
import PackageDescription
diff --git a/ParseSwift.playground/Pages/10 - Cloud Code.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/10 - Cloud Code.xcplaygroundpage/Contents.swift
index d644f8a80..484a32497 100644
--- a/ParseSwift.playground/Pages/10 - Cloud Code.xcplaygroundpage/Contents.swift
+++ b/ParseSwift.playground/Pages/10 - Cloud Code.xcplaygroundpage/Contents.swift
@@ -24,7 +24,7 @@ struct Cloud: ParseCloud {
*/
let cloud = Cloud(functionJobName: "hello")
-cloud.callFunction { result in
+cloud.runFunction { result in
switch result {
case .success(let response):
print("Response from cloud function: \(response)")
@@ -33,6 +33,7 @@ cloud.callFunction { result in
}
}
-//: Jobs can be run the same way by using the method `callJob()`
+//: Jobs can be run the same way by using the method `startJob()`
+PlaygroundPage.current.finishExecution()
//: [Next](@next)
diff --git a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift
index 8da3417e5..e0a06e41e 100644
--- a/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift
+++ b/ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift
@@ -177,4 +177,5 @@ print(explain)
let hint = try query2.find(explain: false, hint: "objectId")
print(hint)
+PlaygroundPage.current.finishExecution()
//: [Next](@next)
diff --git a/ParseSwift.playground/Pages/8 - Pointers.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/8 - Pointers.xcplaygroundpage/Contents.swift
index 4b1aab7ed..0209dc619 100644
--- a/ParseSwift.playground/Pages/8 - Pointers.xcplaygroundpage/Contents.swift
+++ b/ParseSwift.playground/Pages/8 - Pointers.xcplaygroundpage/Contents.swift
@@ -84,4 +84,5 @@ author2.save { result in
}
}
+PlaygroundPage.current.finishExecution()
//: [Next](@next)
diff --git a/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift
index 9570d10a6..c684fb5c8 100644
--- a/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift
+++ b/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift
@@ -151,4 +151,6 @@ do {
/*: Files can also be saved from files located on your device by using:
let localFile = ParseFile(name: "hello.txt", localURL: URL)
*/
+
+PlaygroundPage.current.finishExecution()
//: [Next](@next)
diff --git a/ParseSwift.playground/contents.xcplayground b/ParseSwift.playground/contents.xcplayground
index 3db5401e4..e8d68dcdc 100644
--- a/ParseSwift.playground/contents.xcplayground
+++ b/ParseSwift.playground/contents.xcplayground
@@ -12,4 +12,4 @@
-
\ No newline at end of file
+
diff --git a/ParseSwift.podspec b/ParseSwift.podspec
index 18b1ea68b..c25f53ec9 100644
--- a/ParseSwift.podspec
+++ b/ParseSwift.podspec
@@ -10,12 +10,11 @@ Pod::Spec.new do |s|
:git => "#{s.homepage}.git",
:tag => "#{s.version}",
}
- s.pod_target_xcconfig = { 'SWIFT_VERSION' => '5.0' }
s.ios.deployment_target = "11.0"
s.osx.deployment_target = "10.13"
s.tvos.deployment_target = "11.0"
s.watchos.deployment_target = "4.0"
- s.swift_versions = ['5.0']
+ s.swift_versions = ['5.1', '5.2', '5.3']
s.source_files = "Sources/ParseSwift/**/*.swift"
s.license = {
:type => "MIT",
diff --git a/Sources/ParseSwift/Objects/ParseInstallation.swift b/Sources/ParseSwift/Objects/ParseInstallation.swift
index f19d0fa7d..e710d6e78 100644
--- a/Sources/ParseSwift/Objects/ParseInstallation.swift
+++ b/Sources/ParseSwift/Objects/ParseInstallation.swift
@@ -31,7 +31,7 @@ import AppKit
`ParseInstallation` installations which have a valid `deviceToken` and are saved to
the Parse cloud can be used to target push notifications.
- - warning: Only use `ParseInstallation` installations on the main thread as they
+ - warning: Only use `ParseInstallation.current` installations on the main thread as they
require UIApplication for `badge`
*/
public protocol ParseInstallation: ParseObject {
diff --git a/Sources/ParseSwift/Types/ParseCloud.swift b/Sources/ParseSwift/Types/ParseCloud.swift
index 27410a00f..0b8a5a622 100644
--- a/Sources/ParseSwift/Types/ParseCloud.swift
+++ b/Sources/ParseSwift/Types/ParseCloud.swift
@@ -25,30 +25,30 @@ public protocol ParseCloud: ParseType, Decodable, CustomDebugStringConvertible {
extension ParseCloud {
/**
- Calls *synchronously* a Cloud Code function and returns a result of it's execution.
+ Calls a Cloud Code function *synchronously* and returns a result of it's execution.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- returns: Returns a JSON response of `AnyCodable` type.
*/
- public func callFunction(options: API.Options = []) throws -> AnyCodable {
- try callFunctionCommand().execute(options: options)
+ public func runFunction(options: API.Options = []) throws -> AnyCodable {
+ try runFunctionCommand().execute(options: options)
}
/**
- Calls *asynchronously* a Cloud Code function and returns a result of it's execution.
+ Calls a Cloud Code function *asynchronously* and returns a result of it's execution.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
- parameter completion: A block that will be called when logging out, completes or fails.
It should have the following argument signature: `(Result)`.
*/
- public func callFunction(options: API.Options = [],
- callbackQueue: DispatchQueue = .main,
- completion: @escaping (Result) -> Void) {
- callFunctionCommand()
+ public func runFunction(options: API.Options = [],
+ callbackQueue: DispatchQueue = .main,
+ completion: @escaping (Result) -> Void) {
+ runFunctionCommand()
.executeAsync(options: options,
callbackQueue: callbackQueue, completion: completion)
}
- internal func callFunctionCommand() -> API.Command {
+ internal func runFunctionCommand() -> API.Command {
return API.Command(method: .POST,
path: .functions(name: functionJobName),
@@ -68,30 +68,30 @@ extension ParseCloud {
// MARK: Jobs
extension ParseCloud {
/**
- Calls *synchronously* a Cloud Code job and returns a result of it's execution.
+ Starts a Cloud Code job *synchronously* and returns a result with the jobStatusId of the job.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- returns: Returns a JSON response of `AnyCodable` type.
*/
- public func callJob(options: API.Options = []) throws -> AnyCodable {
- try callJobCommand().execute(options: options)
+ public func startJob(options: API.Options = []) throws -> AnyCodable {
+ try startJobCommand().execute(options: options)
}
/**
- Calls *asynchronously* a Cloud Code job and returns a result of it's execution.
+ Starts a Cloud Code job *asynchronously* and returns a result with the jobStatusId of the job.
- parameter options: A set of header options sent to the server. Defaults to an empty set.
- parameter callbackQueue: The queue to return to after completion. Default value of .main.
- parameter completion: A block that will be called when logging out, completes or fails.
It should have the following argument signature: `(Result)`.
*/
- public func callJob(options: API.Options = [],
- callbackQueue: DispatchQueue = .main,
- completion: @escaping (Result) -> Void) {
- callJobCommand()
+ public func startJob(options: API.Options = [],
+ callbackQueue: DispatchQueue = .main,
+ completion: @escaping (Result) -> Void) {
+ startJobCommand()
.executeAsync(options: options,
callbackQueue: callbackQueue, completion: completion)
}
- internal func callJobCommand() -> API.Command {
+ internal func startJobCommand() -> API.Command {
return API.Command(method: .POST,
path: .jobs(name: functionJobName),
body: self) { (data) -> AnyCodable in
diff --git a/Tests/ParseSwiftTests/ParseCloudTests.swift b/Tests/ParseSwiftTests/ParseCloudTests.swift
index b9d3c3f83..9327b4f66 100644
--- a/Tests/ParseSwiftTests/ParseCloudTests.swift
+++ b/Tests/ParseSwiftTests/ParseCloudTests.swift
@@ -83,7 +83,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
func testCallFunctionCommand() throws {
let cloud = Cloud(functionJobName: "test")
- let command = cloud.callFunctionCommand()
+ let command = cloud.runFunctionCommand()
XCTAssertNotNil(command)
XCTAssertEqual(command.path.urlComponent, "/functions/test")
XCTAssertEqual(command.method, API.Method.POST)
@@ -93,7 +93,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
func testCallFunctionWithArgsCommand() throws {
let cloud = Cloud2(functionJobName: "test", customKey: "parse")
- let command = cloud.callFunctionCommand()
+ let command = cloud.runFunctionCommand()
XCTAssertNotNil(command)
XCTAssertEqual(command.path.urlComponent, "/functions/test")
XCTAssertEqual(command.method, API.Method.POST)
@@ -115,7 +115,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- let functionResponse = try cloud.callFunction()
+ let functionResponse = try cloud.runFunction()
XCTAssertEqual(functionResponse, AnyCodable())
} catch {
XCTFail(error.localizedDescription)
@@ -138,7 +138,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- let functionResponse = try cloud.callFunction()
+ let functionResponse = try cloud.runFunction()
guard let resultAsDictionary = functionResponse.value as? [String: String] else {
XCTFail("Should have casted result to dictionary")
return
@@ -166,7 +166,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- _ = try cloud.callFunction()
+ _ = try cloud.runFunction()
XCTFail("Should have thrown ParseError")
} catch {
if let error = error as? ParseError {
@@ -181,7 +181,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
let expectation1 = XCTestExpectation(description: "Logout user1")
let cloud = Cloud(functionJobName: "test")
- cloud.callFunction(callbackQueue: callbackQueue) { result in
+ cloud.runFunction(callbackQueue: callbackQueue) { result in
switch result {
@@ -239,7 +239,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
let expectation1 = XCTestExpectation(description: "Logout user1")
let cloud = Cloud(functionJobName: "test")
- cloud.callFunction(callbackQueue: callbackQueue) { result in
+ cloud.runFunction(callbackQueue: callbackQueue) { result in
switch result {
@@ -272,7 +272,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
func testCallJobCommand() throws {
let cloud = Cloud(functionJobName: "test")
- let command = cloud.callJobCommand()
+ let command = cloud.startJobCommand()
XCTAssertNotNil(command)
XCTAssertEqual(command.path.urlComponent, "/jobs/test")
XCTAssertEqual(command.method, API.Method.POST)
@@ -282,7 +282,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
func testCallJobWithArgsCommand() throws {
let cloud = Cloud2(functionJobName: "test", customKey: "parse")
- let command = cloud.callJobCommand()
+ let command = cloud.startJobCommand()
XCTAssertNotNil(command)
XCTAssertEqual(command.path.urlComponent, "/jobs/test")
XCTAssertEqual(command.method, API.Method.POST)
@@ -304,7 +304,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- let functionResponse = try cloud.callJob()
+ let functionResponse = try cloud.startJob()
XCTAssertEqual(functionResponse, AnyCodable())
} catch {
XCTFail(error.localizedDescription)
@@ -325,7 +325,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- let functionResponse = try cloud.callJob()
+ let functionResponse = try cloud.startJob()
guard let resultAsDictionary = functionResponse.value as? [String: String] else {
XCTFail("Should have casted result to dictionary")
return
@@ -353,7 +353,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
}
do {
let cloud = Cloud(functionJobName: "test")
- _ = try cloud.callJob()
+ _ = try cloud.startJob()
XCTFail("Should have thrown ParseError")
} catch {
if let error = error as? ParseError {
@@ -368,7 +368,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
let expectation1 = XCTestExpectation(description: "Logout user1")
let cloud = Cloud(functionJobName: "test")
- cloud.callJob(callbackQueue: callbackQueue) { result in
+ cloud.startJob(callbackQueue: callbackQueue) { result in
switch result {
@@ -426,7 +426,7 @@ class ParseCloudTests: XCTestCase { // swiftlint:disable:this type_body_length
let expectation1 = XCTestExpectation(description: "Logout user1")
let cloud = Cloud(functionJobName: "test")
- cloud.callJob(callbackQueue: callbackQueue) { result in
+ cloud.startJob(callbackQueue: callbackQueue) { result in
switch result {