Skip to content

Commit 93f0d2f

Browse files
cbaker6TomWFox
andauthored
Apply suggestions from code review
Co-authored-by: Tom Fox <[email protected]>
1 parent 045a516 commit 93f0d2f

File tree

7 files changed

+15
-16
lines changed

7 files changed

+15
-16
lines changed

ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ initializeParse()
99

1010
//: Create your own ValueTyped ParseObject
1111
struct GameScore: ParseObject {
12-
//: Those are required for Object
12+
//: These are required for any Object
1313
var objectId: String?
1414
var createdAt: Date?
1515
var updatedAt: Date?
@@ -64,7 +64,7 @@ subscription.handleEvent { _, event in
6464
}
6565
}
6666

67-
//: Now go to your dashboard, goto the GameScore table and add, update, remove rows.
67+
//: Now go to your dashboard, go to the GameScore table and add, update or remove rows.
6868
//: You should receive notifications for each.
6969

7070
//: This is how you register to receive notificaitons about being unsubscribed.
@@ -88,10 +88,10 @@ query2.fields("score")
8888
//: Subscribe to your new query.
8989
let subscription2 = query2.subscribe!
9090

91-
//: As before, setup your subscription and event handlers
91+
//: As before, setup your subscription and event handlers.
9292
subscription2.handleSubscribe { subscribedQuery, isNew in
9393

94-
//: You can check this subscription is for this query\
94+
//: You can check this subscription is for this query.
9595
if isNew {
9696
print("Successfully subscribed to new query \(subscribedQuery)")
9797
} else {
@@ -115,7 +115,7 @@ subscription2.handleEvent { _, event in
115115
}
116116
}
117117

118-
//: Now go to your dashboard, goto the GameScore table and add, update, remove rows.
118+
//: Now go to your dashboard, go to the GameScore table and add, update or remove rows.
119119
//: You should receive notifications for each, but only with your fields information.
120120

121121
//: This is how you register to receive notificaitons about being unsubscribed.

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Please checkout the [Swift Playground](https://github.com/parse-community/Parse-
8080

8181

8282
## LiveQuery
83-
`Query` is one of the key concepts for Parse. It allows you to retrieve `ParseObject`s by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, `Query` is based on a pull model, which is not suitable for apps that need real-time support.
83+
`Query` is one of the key concepts on the Parse Platform. It allows you to retrieve `ParseObject`s by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, `Query` is based on a pull model, which is not suitable for apps that need real-time support.
8484

8585
Suppose you are building an app that allows multiple users to edit the same file at the same time. `Query` would not be an ideal tool since you can not know when to query from the server to get the updates.
8686

@@ -158,4 +158,3 @@ Handling errors is and other events is similar, take a look at the `Subscription
158158
### Advanced Usage
159159

160160
You are not limited to a single Live Query Client - you can create multiple instances of `ParseLiveQuery`, use certificate authentication and pinning, receive metrics about each client connection, connect to individual server URLs, and more.
161-

Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Foundation
1515
public protocol ParseLiveQueryDelegate: AnyObject {
1616

1717
/**
18-
Respond to authentication requests from a ParseLiveQuery server. If you become a delegate
18+
Respond to authentication requests from a ParseLiveQuery Server. If you become a delegate
1919
and implement this method you will need to with
2020
`completionHandler(.performDefaultHandling, nil)` to accept all connections approved
2121
by the OS. Becoming a delegate allows you to make authentication decisions for all connections in

Sources/ParseSwift/LiveQuery/Protocols/SubscriptionHandlable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public protocol SubscriptionHandlable: AnyObject {
1919
var query: Query<Object> {get set}
2020

2121
/**
22-
Tells the handler that an event has been received from the `ParseLiveQuery` server.
22+
Tells the handler that an event has been received from the `ParseLiveQuery` Server.
2323
- parameter eventData: The event data that has been recieved from the server.
2424
*/
2525
func didReceive(_ eventData: Data) throws

Sources/ParseSwift/LiveQuery/Subscription.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Foundation
1111

1212
/**
13-
Represents an update on a specific object from the `ParseLiveQuery` server.
13+
Represents an update on a specific object from the `ParseLiveQuery` Server.
1414
- Entered: The object has been updated, and is now included in the query.
1515
- Left: The object has been updated, and is no longer included in the query.
1616
- Created: The object has been created, and is a part of the query.
@@ -131,9 +131,9 @@ extension Subscription {
131131
subscription.handle(Event.Created) { query, object in
132132
// Called whenever an object is creaated
133133
}
134-
- parameter eventType: The event type to handle. You should pass one of the enum cases in `Event`
135-
- parameter handler: The callback to register
136-
- returns: The same subscription, for easy chaining
134+
- parameter eventType: The event type to handle. You should pass one of the enum cases in `Event`.
135+
- parameter handler: The callback to register.
136+
- returns: The same subscription, for easy chaining.
137137
*/
138138
@discardableResult public func handle(_ eventType: @escaping (T) -> Event<T>,
139139
_ handler: @escaping (Query<T>, T) -> Void) -> Subscription {

Sources/ParseSwift/Storage/PrimitiveObjectStore.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Foundation
1414
*/
1515
public protocol PrimitiveObjectStore {
1616
/// Delete an object from the store.
17-
/// - parameter key: The unique key value of the object
17+
/// - parameter key: The unique key value of the object.
1818
mutating func delete(valueFor key: String) throws
1919
/// Delete all objects from the store.
2020
mutating func deleteAll() throws

Sources/ParseSwift/Types/Query.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ public class Query<T>: Encodable, Equatable where T: ParseObject {
669669
A variadic list of fields to receive when receiving a `ParseLiveQuery`.
670670

671671
Suppose the `ParseObject` Player contains three fields name, id and age.
672-
If you are only interested in the change of the name field, you can set query.fields to "name".
672+
If you are only interested in the change of the name field, you can set `query.fields` to "name".
673673
In this situation, when the change of a Player `ParseObject` fulfills the subscription, only the
674674
name field will be sent to the clients instead of the full Player `ParseObject`.
675675
- warning: This is only for `ParseLiveQuery`.
@@ -685,7 +685,7 @@ public class Query<T>: Encodable, Equatable where T: ParseObject {
685685
A list of fields to receive when receiving a `ParseLiveQuery`.
686686

687687
Suppose the `ParseObject` Player contains three fields name, id and age.
688-
If you are only interested in the change of the name field, you can set query.fields to "name".
688+
If you are only interested in the change of the name field, you can set `query.fields` to "name".
689689
In this situation, when the change of a Player `ParseObject` fulfills the subscription, only the
690690
name field will be sent to the clients instead of the full Player `ParseObject`.
691691
- warning: This is only for `ParseLiveQuery`.

0 commit comments

Comments
 (0)