Skip to content

Commit d37d519

Browse files
authored
Merge pull request #94 from pusher/tiny-readme-update
changed type of callback for event binding
2 parents b34cddf + 91bac11 commit d37d519

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ You can attach behaviour to these events regardless of the channel the event is
609609
let pusher = Pusher(key: "YOUR_APP_KEY")
610610
pusher.subscribe("my-channel")
611611
612-
pusher.bind(callback: { (data: AnyObject?) -> Void in
612+
pusher.bind(callback: { (data: Any?) -> Void in
613613
if let data = data as? [String : AnyObject] {
614614
if let commenter = data["commenter"] as? String, message = data["message"] as? String {
615615
print("\(commenter) wrote \(message)")
@@ -640,7 +640,7 @@ These are bound to a specific channel, and mean that you can reuse event names i
640640
let pusher = Pusher(key: "YOUR_APP_KEY")
641641
let myChannel = pusher.subscribe("my-channel")
642642
643-
myChannel.bind(eventName: "new-price", callback: { (data: AnyObject?) -> Void in
643+
myChannel.bind(eventName: "new-price", callback: { (data: Any?) -> Void in
644644
if let data = data as? [String : AnyObject] {
645645
if let price = data["price"] as? String, company = data["company"] as? String {
646646
print("\(company) is now priced at \(price)")
@@ -668,7 +668,7 @@ Errors are sent to the client for which they are relevant with an event name of
668668
669669
#### Swift
670670
```swift
671-
pusher.bind({ (message: AnyObject?) in
671+
pusher.bind({ (message: Any?) in
672672
if let message = message as? [String: AnyObject], eventName = message["event"] as? String where eventName == "pusher:error" {
673673
if let data = message["data"] as? [String: AnyObject], errorMessage = data["message"] as? String {
674674
print("Error message: \(errorMessage)")
@@ -724,7 +724,7 @@ You can remove previously-bound handlers from an object by using the `unbind` fu
724724
let pusher = Pusher(key: "YOUR_APP_KEY")
725725
let myChannel = pusher.subscribe("my-channel")
726726

727-
let eventHandlerId = myChannel.bind(eventName: "new-price", callback: { (data: AnyObject?) -> Void in
727+
let eventHandlerId = myChannel.bind(eventName: "new-price", callback: { (data: Any?) -> Void in
728728
...
729729
})
730730

0 commit comments

Comments
 (0)