Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit b0f8aab

Browse files
jlnquereflovilmart
authored andcommitted
fix(Subscription): add @discardableResult to every handle* method (#119)
1 parent d174fb0 commit b0f8aab

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Sources/ParseLiveQuery/Subscription.swift

+6-6
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ open class Subscription<T>: SubscriptionHandling where T: PFObject {
129129

130130
- returns: The same subscription, for easy chaining
131131
*/
132-
open func handleError(_ handler: @escaping (PFQuery<T>, Error) -> Void) -> Subscription {
132+
@discardableResult open func handleError(_ handler: @escaping (PFQuery<T>, Error) -> Void) -> Subscription {
133133
errorHandlers.append(handler)
134134
return self
135135
}
@@ -141,7 +141,7 @@ open class Subscription<T>: SubscriptionHandling where T: PFObject {
141141

142142
- returns: The same subscription, for easy chaining.
143143
*/
144-
open func handleEvent(_ handler: @escaping (PFQuery<T>, Event<T>) -> Void) -> Subscription {
144+
@discardableResult open func handleEvent(_ handler: @escaping (PFQuery<T>, Event<T>) -> Void) -> Subscription {
145145
eventHandlers.append(handler)
146146
return self
147147
}
@@ -153,7 +153,7 @@ open class Subscription<T>: SubscriptionHandling where T: PFObject {
153153

154154
- returns: The same subscription, for easy chaining.
155155
*/
156-
open func handleSubscribe(_ handler: @escaping (PFQuery<T>) -> Void) -> Subscription {
156+
@discardableResult open func handleSubscribe(_ handler: @escaping (PFQuery<T>) -> Void) -> Subscription {
157157
subscribeHandlers.append(handler)
158158
return self
159159
}
@@ -165,7 +165,7 @@ open class Subscription<T>: SubscriptionHandling where T: PFObject {
165165

166166
- returns: The same subscription, for easy chaining.
167167
*/
168-
open func handleUnsubscribe(_ handler: @escaping (PFQuery<T>) -> Void) -> Subscription {
168+
@discardableResult open func handleUnsubscribe(_ handler: @escaping (PFQuery<T>) -> Void) -> Subscription {
169169
unsubscribeHandlers.append(handler)
170170
return self
171171
}
@@ -208,7 +208,7 @@ extension Subscription {
208208

209209
- returns: The same subscription, for easy chaining
210210
*/
211-
public func handle<E: Error>(
211+
@discardableResult public func handle<E: Error>(
212212
_ errorType: E.Type = E.self,
213213
_ handler: @escaping (PFQuery<T>, E) -> Void
214214
) -> Subscription {
@@ -235,7 +235,7 @@ extension Subscription {
235235
- returns: The same subscription, for easy chaining
236236

237237
*/
238-
public func handle(_ eventType: @escaping (T) -> Event<T>, _ handler: @escaping (PFQuery<T>, T) -> Void) -> Subscription {
238+
@discardableResult public func handle(_ eventType: @escaping (T) -> Event<T>, _ handler: @escaping (PFQuery<T>, T) -> Void) -> Subscription {
239239
return handleEvent { query, event in
240240
switch event {
241241
case .entered(let obj) where eventType(obj) == event: handler(query, obj)

0 commit comments

Comments
 (0)