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+)
12
12
-----------------
13
13
1 . Copy the SwiftIO folder into your Xcode project!
14
14
15
- CocoaPods (iOS 8+)
15
+ CocoaPods 0.36.0 or later (iOS 8+)
16
16
------------------
17
- Install cocoapods 0.36.0 or later:
18
-
19
- ```
20
- $ gem install cocoapods
21
- ```
22
-
23
17
Create ` Podfile ` and add ` pod 'Socket.IO-Client-Swift' ` :
24
18
25
19
``` ruby
@@ -42,7 +36,6 @@ Import in your swift file:
42
36
import Socket_IO_Client_Swift
43
37
```
44
38
45
-
46
39
API
47
40
===
48
41
Constructor
@@ -105,6 +98,11 @@ socket.on("ackEvent") {data, ack in
105
98
println (" Got ackEvent" )
106
99
}
107
100
101
+ // data is an array
102
+ if let int = data? [1 ] as? Int {
103
+ println (" Got int" )
104
+ }
105
+
108
106
socket.emitWithAck (" ackTest" , " test" ).onAck {data in
109
107
println (data? [0 ])
110
108
}
@@ -118,25 +116,6 @@ socket.on("jsonTest") {data, ack in
118
116
}
119
117
}
120
118
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
-
140
119
// Connecting
141
120
socket.connect ()
142
121
```
You can’t perform that action at this time.
0 commit comments