Skip to content

Commit 0030fa4

Browse files
committed
Make functions for binding to events a discardableResult
1 parent e8bf946 commit 0030fa4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ let pusher = Pusher(key: "YOUR_APP_KEY")
527527
528528
let chan = pusher.subscribeToPresenceChannel("presence-channel")
529529
530-
let _ = chan.bind(eventName: "pusher:subscription_succeeded", callback: { data in
530+
chan.bind(eventName: "pusher:subscription_succeeded", callback: { data in
531531
print("Subscribed!")
532532
print("I can now access myId: \(chan.myId)")
533533
print("And here are the channel members: \(chan.members)")

Source/PusherChannel.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ open class PusherChannel: NSObject {
6262

6363
- returns: A unique callbackId that can be used to unbind the callback at a later time
6464
*/
65-
open func bind(eventName: String, callback: @escaping (Any?) -> Void) -> String {
65+
@discardableResult open func bind(eventName: String, callback: @escaping (Any?) -> Void) -> String {
6666
let randomId = UUID().uuidString
6767
let eventHandler = EventHandler(id: randomId, callback: callback)
6868
if self.eventHandlers[eventName] != nil {

Source/PusherSwift.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ let CLIENT_NAME = "pusher-websocket-swift"
114114

115115
- returns: A unique string that can be used to unbind the callback from the client
116116
*/
117-
open func bind(_ callback: @escaping (Any?) -> Void) -> String {
117+
@discardableResult open func bind(_ callback: @escaping (Any?) -> Void) -> String {
118118
return self.connection.addCallbackToGlobalChannel(callback)
119119
}
120120

0 commit comments

Comments
 (0)