File tree Expand file tree Collapse file tree 1 file changed +6
-27
lines changed
Expand file tree Collapse file tree 1 file changed +6
-27
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,8 @@ Manually (iOS 7+)
1212-----------------
13131 . Copy the SwiftIO folder into your Xcode project!
1414
15- CocoaPods (iOS 8+)
15+ CocoaPods 0.36.0 or later (iOS 8+)
1616------------------
17- Install cocoapods 0.36.0 or later:
18-
19- ```
20- $ gem install cocoapods
21- ```
22-
2317Create ` Podfile ` and add ` pod 'Socket.IO-Client-Swift' ` :
2418
2519``` ruby
@@ -42,7 +36,6 @@ Import in your swift file:
4236import Socket_IO_Client_Swift
4337```
4438
45-
4639API
4740===
4841Constructor
@@ -105,6 +98,11 @@ socket.on("ackEvent") {data, ack in
10598 println (" Got ackEvent" )
10699 }
107100
101+ // data is an array
102+ if let int = data? [1 ] as? Int {
103+ println (" Got int" )
104+ }
105+
108106 socket.emitWithAck (" ackTest" , " test" ).onAck {data in
109107 println (data? [0 ])
110108 }
@@ -118,25 +116,6 @@ socket.on("jsonTest") {data, ack in
118116 }
119117}
120118
121- // Event items are passed by an array
122- socket.on (" multipleItems" ) {data, ack in
123- if data == nil {
124- return
125- }
126-
127- if let str = data! [0 ] as? String {
128- println (str)
129- }
130-
131- if let arr = data! [1 ] as? [Int ] {
132- println (arr)
133- }
134-
135- if let obj = data! [4 ] as? NSDictionary {
136- println (obj[" test" ])
137- }
138- }
139-
140119// Connecting
141120socket.connect ()
142121```
You can’t perform that action at this time.
0 commit comments