This commit is contained in:
Erik 2015-09-18 11:52:35 -04:00
parent 0e791176bd
commit f464eba995
3 changed files with 17 additions and 17 deletions

View File

@ -37,10 +37,10 @@
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES">
buildConfiguration = "Debug">
<Testables> <Testables>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">
@ -62,15 +62,18 @@
ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj"> ReferencedContainer = "container:Socket.IO-Client-Swift.xcodeproj">
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0" launchStyle = "0"
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO" ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES" debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES"> allowLocationSimulation = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
@ -85,10 +88,10 @@
</AdditionalOptions> </AdditionalOptions>
</LaunchAction> </LaunchAction>
<ProfileAction <ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = "" savedToolIdentifier = ""
useCustomWorkingDirectory = "NO" useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES"> debugDocumentVersioning = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference

View File

@ -27,22 +27,18 @@ import Foundation
public class SocketAckEmitter: NSObject { public class SocketAckEmitter: NSObject {
unowned let socket: SocketIOClient unowned let socket: SocketIOClient
var ackNum: Int let ackNum: Int
public subscript(items: AnyObject...) -> Bool {
socket.emitAck(ackNum, withItems: items)
return true
}
public subscript(items: [AnyObject]) -> NSString {
socket.emitAck(ackNum, withItems: items)
return "Done"
}
init(socket: SocketIOClient, ackNum: Int) { init(socket: SocketIOClient, ackNum: Int) {
self.socket = socket self.socket = socket
self.ackNum = ackNum self.ackNum = ackNum
} }
public func ackWith(items: [AnyObject]) {
socket.emitAck(ackNum, withItems: items)
}
}
public func <-(lhs: SocketAckEmitter?, rhs: [AnyObject]) {
lhs?.ackWith(rhs)
} }

View File

@ -24,6 +24,7 @@
import Foundation import Foundation
infix operator <- {}
public typealias AckCallback = ([AnyObject]) -> Void public typealias AckCallback = ([AnyObject]) -> Void
public typealias NormalCallback = ([AnyObject], SocketAckEmitter?) -> Void public typealias NormalCallback = ([AnyObject], SocketAckEmitter?) -> Void
public typealias OnAckCallback = (timeoutAfter: UInt64, callback: AckCallback) -> Void public typealias OnAckCallback = (timeoutAfter: UInt64, callback: AckCallback) -> Void