work on standardizing module name

This commit is contained in:
Erik 2016-01-14 16:01:46 -05:00
parent ee5934de6a
commit de3ca964ab
9 changed files with 64 additions and 66 deletions

View File

@ -5,7 +5,7 @@ Pod::Spec.new do |s|
s.description = <<-DESC s.description = <<-DESC
Socket.IO-client for iOS and OS X. Socket.IO-client for iOS and OS X.
Supports ws/wss/polling connections and binary. Supports ws/wss/polling connections and binary.
For socket.io 1.0+ and Swift 1.2. For socket.io 1.0+ and Swift.
DESC DESC
s.homepage = "https://github.com/socketio/socket.io-client-swift" s.homepage = "https://github.com/socketio/socket.io-client-swift"
s.license = { :type => 'MIT' } s.license = { :type => 'MIT' }

View File

@ -8,9 +8,9 @@
/* Begin PBXBuildFile section */ /* Begin PBXBuildFile section */
572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF21F1B51F16C00EEBB58 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */; }; 572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */; };
572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; }; 572EF23D1B51F18A00EEBB58 /* SocketIO-Mac.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */; settings = {ATTRIBUTES = (Public, ); }; };
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; }; 572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */; };
57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; }; 57634A111BD9B46A00E19CD7 /* SocketIO-iOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; }; 57634A231BD9B46D00E19CD7 /* SocketSideEffectTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7472C65E1BCAC46E003CA70D /* SocketSideEffectTest.swift */; };
57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; }; 57634A2A1BD9B46D00E19CD7 /* SocketEngineTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 741F39ED1BD025D80026C9CC /* SocketEngineTest.swift */; };
@ -153,12 +153,12 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
572EF2191B51F16C00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
572EF21D1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF21D1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-iOS.h"; sourceTree = "<group>"; }; 572EF21E1B51F16C00EEBB58 /* SocketIO-iOS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-iOS.h"; sourceTree = "<group>"; };
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-iOSTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
572EF22A1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF22A1B51F16C00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF2381B51F18A00EEBB58 /* SocketIO.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIO.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketIOClientSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 572EF23B1B51F18A00EEBB58 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; }; 572EF23C1B51F18A00EEBB58 /* SocketIO-Mac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SocketIO-Mac.h"; sourceTree = "<group>"; };
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "SocketIO-MacTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -205,7 +205,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2251B51F16C00EEBB58 /* SocketIO.framework in Frameworks */, 572EF2251B51F16C00EEBB58 /* SocketIOClientSwift.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -220,7 +220,7 @@
isa = PBXFrameworksBuildPhase; isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
572EF2431B51F18A00EEBB58 /* SocketIO.framework in Frameworks */, 572EF2431B51F18A00EEBB58 /* SocketIOClientSwift.framework in Frameworks */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
@ -257,9 +257,9 @@
572EF21A1B51F16C00EEBB58 /* Products */ = { 572EF21A1B51F16C00EEBB58 /* Products */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
572EF2191B51F16C00EEBB58 /* SocketIO.framework */, 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */,
572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */, 572EF2241B51F16C00EEBB58 /* SocketIO-iOSTests.xctest */,
572EF2381B51F18A00EEBB58 /* SocketIO.framework */, 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */,
572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */, 572EF2421B51F18A00EEBB58 /* SocketIO-MacTests.xctest */,
57634A161BD9B46A00E19CD7 /* SocketIO.framework */, 57634A161BD9B46A00E19CD7 /* SocketIO.framework */,
57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */, 57634A3B1BD9B46D00E19CD7 /* SocketIO-tvOSTests.xctest */,
@ -411,7 +411,7 @@
); );
name = "SocketIO-iOS"; name = "SocketIO-iOS";
productName = "SocketIO-iOS"; productName = "SocketIO-iOS";
productReference = 572EF2191B51F16C00EEBB58 /* SocketIO.framework */; productReference = 572EF2191B51F16C00EEBB58 /* SocketIOClientSwift.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = { 572EF2231B51F16C00EEBB58 /* SocketIO-iOSTests */ = {
@ -447,7 +447,7 @@
); );
name = "SocketIO-Mac"; name = "SocketIO-Mac";
productName = "SocketIO-Mac"; productName = "SocketIO-Mac";
productReference = 572EF2381B51F18A00EEBB58 /* SocketIO.framework */; productReference = 572EF2381B51F18A00EEBB58 /* SocketIOClientSwift.framework */;
productType = "com.apple.product-type.framework"; productType = "com.apple.product-type.framework";
}; };
572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = { 572EF2411B51F18A00EEBB58 /* SocketIO-MacTests */ = {
@ -782,7 +782,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIOClientSwift;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -797,7 +797,7 @@
ENABLE_BITCODE = YES; ENABLE_BITCODE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0; IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MACOSX_DEPLOYMENT_TARGET = 10.10; MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_NAME = SocketIO; PRODUCT_NAME = SocketIOClientSwift;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TVOS_DEPLOYMENT_TARGET = 9.0; TVOS_DEPLOYMENT_TARGET = 9.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0; WATCHOS_DEPLOYMENT_TARGET = 2.0;
@ -850,7 +850,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = YES; MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES; ONLY_ACTIVE_ARCH = YES;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = io.socket.SocketIOClientSwift;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@ -900,7 +900,7 @@
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = NO; MTL_ENABLE_DEBUG_INFO = NO;
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_BUNDLE_IDENTIFIER = io.socket.SocketIOClientSwift;
SDKROOT = iphoneos; SDKROOT = iphoneos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
TARGETED_DEVICE_FAMILY = "1,2"; TARGETED_DEVICE_FAMILY = "1,2";

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketAckManagerTest: XCTestCase { class SocketAckManagerTest: XCTestCase {
var ackManager = SocketAckManager() var ackManager = SocketAckManager()

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketBasicPacketTest: XCTestCase { class SocketBasicPacketTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketEngineTest: XCTestCase { class SocketEngineTest: XCTestCase {
var client: SocketIOClient! var client: SocketIOClient!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketNamespacePacketTest: XCTestCase { class SocketNamespacePacketTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketParserTest: XCTestCase { class SocketParserTest: XCTestCase {
let testSocket = SocketIOClient(socketURL: "") let testSocket = SocketIOClient(socketURL: "")

View File

@ -7,7 +7,7 @@
// //
import XCTest import XCTest
@testable import SocketIO @testable import SocketIOClientSwift
class SocketSideEffectTest: XCTestCase { class SocketSideEffectTest: XCTestCase {
let data = "test".dataUsingEncoding(NSUTF8StringEncoding)! let data = "test".dataUsingEncoding(NSUTF8StringEncoding)!

View File

@ -147,36 +147,35 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
/** /**
Connect to the server. If we aren't connected after timeoutAfter, call handler Connect to the server. If we aren't connected after timeoutAfter, call handler
*/ */
public func connect(timeoutAfter timeoutAfter: Int, public func connect(timeoutAfter timeoutAfter: Int, withTimeoutHandler handler: (() -> Void)?) {
withTimeoutHandler handler: (() -> Void)?) { assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
assert(timeoutAfter >= 0, "Invalid timeout: \(timeoutAfter)")
guard status != .Connected else { guard status != .Connected else {
DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket", DefaultSocketLogger.Logger.log("Tried connecting on an already connected socket",
type: logType) type: logType)
return return
} }
status = .Connecting status = .Connecting
if engine == nil || forceNew { if engine == nil || forceNew {
addEngine().open(connectParams) addEngine().open(connectParams)
} else { } else {
engine?.open(connectParams) engine?.open(connectParams)
} }
guard timeoutAfter != 0 else { return } guard timeoutAfter != 0 else { return }
let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC)) let time = dispatch_time(DISPATCH_TIME_NOW, Int64(timeoutAfter) * Int64(NSEC_PER_SEC))
dispatch_after(time, handleQueue) {[weak self] in dispatch_after(time, handleQueue) {[weak self] in
if let this = self where this.status != .Connected { if let this = self where this.status != .Connected {
this.status = .Closed this.status = .Closed
this.engine?.close() this.engine?.close()
handler?() handler?()
}
} }
}
} }
private func createOnAck(items: [AnyObject]) -> OnAckCallback { private func createOnAck(items: [AnyObject]) -> OnAckCallback {
@ -330,22 +329,20 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
/** /**
Causes an event to be handled. Only use if you know what you're doing. Causes an event to be handled. Only use if you know what you're doing.
*/ */
public func handleEvent(event: String, data: [AnyObject], isInternalMessage: Bool, public func handleEvent(event: String, data: [AnyObject], isInternalMessage: Bool, withAck ack: Int = -1) {
withAck ack: Int = -1) { guard status == .Connected || isInternalMessage else {
guard status == .Connected || isInternalMessage else { return
return }
DefaultSocketLogger.Logger.log("Handling event: %@ with data: %@", type: logType, args: event, data ?? "")
dispatch_async(handleQueue) {
self.anyHandler?(SocketAnyEvent(event: event, items: data))
for handler in self.handlers where handler.event == event {
handler.executeCallback(data, withAck: ack, withSocket: self)
} }
}
DefaultSocketLogger.Logger.log("Handling event: %@ with data: %@", type: logType, args: event, data ?? "")
dispatch_async(handleQueue) {
self.anyHandler?(SocketAnyEvent(event: event, items: data))
for handler in self.handlers where handler.event == event {
handler.executeCallback(data, withAck: ack, withSocket: self)
}
}
} }
/** /**
@ -436,7 +433,8 @@ public final class SocketIOClient: NSObject, SocketEngineClient, SocketParsable
} }
public func parseEngineMessage(msg: String) { public func parseEngineMessage(msg: String) {
DefaultSocketLogger.Logger.log("Should parse message", type: "SocketIOClient") DefaultSocketLogger.Logger.log("Should parse message: %@", type: "SocketIOClient", args: msg)
dispatch_async(parseQueue) { dispatch_async(parseQueue) {
self.parseSocketMessage(msg) self.parseSocketMessage(msg)
} }