Skip to content

Commit fc2852d

Browse files
committed
Merge branch 'development'
* development: Fix manifest use .upToNextMajor see if this fixes spm update starscream dev start work on fixing spm bump tools versions Update proj for swift 4 make build quiet Just use xcodebuild for swift4.0 branch Build swift4.0 branch Update xcodeproj after rebase Add missing @objc Update for latest xcode beta guard creating prefixless data Initial Swift4 work Rework logging protocol to use autoclosure Remove another NS* use Don't use NSDictionary
2 parents 654d71a + 9be3184 commit fc2852d

22 files changed

+144
-77
lines changed

.swift-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1
1+
4.0

.travis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
language: objective-c
22
xcode_project: Socket.IO-Client-Swift.xcodeproj # path to your xcodeproj folder
33
xcode_scheme: SocketIO-iOS
4-
osx_image: xcode8.3
4+
osx_image: xcode9
55
branches:
66
only:
77
- master
88
- development
9+
- swift4.0
910
before_install:
1011
- brew update
1112
- brew outdated xctool || brew upgrade xctool
1213
script:
13-
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build-for-testing -quiet
14-
- xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac run-tests --parallelize
14+
- xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build test -quiet
15+
# - xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build-for-testing -quiet
16+
# - xctool -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac run-tests --parallelize
1517
- swift build
16-
#script: xcodebuild -project Socket.IO-Client-Swift.xcodeproj -scheme SocketIO-Mac build test

Package.swift

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
// swift-tools-version:4.0
2+
13
import PackageDescription
24

35
let package = Package(
46
name: "SocketIO",
7+
products: [
8+
.library(name: "SocketIO", targets: ["SocketIO"])
9+
],
510
dependencies: [
6-
.Package(url: "https://github.com/nuclearace/Starscream", majorVersion: 8),
11+
.package(url: "https://github.com/nuclearace/Starscream", .upToNextMajor(from: "8.0.0")),
712
],
8-
exclude: ["Source/Starscream"]
13+
targets: [
14+
.target(name: "SocketIO", dependencies: ["StarscreamSocketIO"], exclude: ["Sources/Starscream"])
15+
]
916
)

Socket.IO-Client-Swift.podspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Pod::Spec.new do |s|
2121
:submodules => true
2222
}
2323
s.pod_target_xcconfig = {
24-
'SWIFT_VERSION' => '3.1'
24+
'SWIFT_VERSION' => '4.0'
2525
}
2626
s.source_files = "Source/SocketIO/**/*.swift", "Source/SocketIO/*.swift"
2727
s.dependency "StarscreamSocketIO", "~> 8.0.5"

Socket.IO-Client-Swift.xcodeproj/project.pbxproj

+39-11
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@
657657
attributes = {
658658
LastSwiftMigration = 0730;
659659
LastSwiftUpdateCheck = 0730;
660-
LastUpgradeCheck = 0800;
660+
LastUpgradeCheck = 0900;
661661
TargetAttributes = {
662662
572EF2181B51F16C00EEBB58 = {
663663
CreatedOnToolsVersion = 6.4;
@@ -667,11 +667,11 @@
667667
};
668668
572EF2371B51F18A00EEBB58 = {
669669
CreatedOnToolsVersion = 6.4;
670-
LastSwiftMigration = 0800;
670+
LastSwiftMigration = 0900;
671671
};
672672
572EF2411B51F18A00EEBB58 = {
673673
CreatedOnToolsVersion = 6.4;
674-
LastSwiftMigration = 0800;
674+
LastSwiftMigration = 0900;
675675
};
676676
};
677677
};
@@ -958,11 +958,19 @@
958958
isa = XCBuildConfiguration;
959959
buildSettings = {
960960
BITCODE_GENERATION_MODE = bitcode;
961+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
961962
CLANG_WARN_BOOL_CONVERSION = YES;
963+
CLANG_WARN_COMMA = YES;
962964
CLANG_WARN_CONSTANT_CONVERSION = YES;
963965
CLANG_WARN_EMPTY_BODY = YES;
964966
CLANG_WARN_ENUM_CONVERSION = YES;
967+
CLANG_WARN_INFINITE_RECURSION = YES;
965968
CLANG_WARN_INT_CONVERSION = YES;
969+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
970+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
971+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
972+
CLANG_WARN_STRICT_PROTOTYPES = YES;
973+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
966974
CLANG_WARN_UNREACHABLE_CODE = YES;
967975
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
968976
CODE_SIGN_IDENTITY = "Developer ID Application";
@@ -992,11 +1000,19 @@
9921000
isa = XCBuildConfiguration;
9931001
buildSettings = {
9941002
BITCODE_GENERATION_MODE = bitcode;
1003+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
9951004
CLANG_WARN_BOOL_CONVERSION = YES;
1005+
CLANG_WARN_COMMA = YES;
9961006
CLANG_WARN_CONSTANT_CONVERSION = YES;
9971007
CLANG_WARN_EMPTY_BODY = YES;
9981008
CLANG_WARN_ENUM_CONVERSION = YES;
1009+
CLANG_WARN_INFINITE_RECURSION = YES;
9991010
CLANG_WARN_INT_CONVERSION = YES;
1011+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
1012+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
1013+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
1014+
CLANG_WARN_STRICT_PROTOTYPES = YES;
1015+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
10001016
CLANG_WARN_UNREACHABLE_CODE = YES;
10011017
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
10021018
CODE_SIGN_IDENTITY = "Developer ID Application";
@@ -1038,7 +1054,7 @@
10381054
CLANG_WARN_UNREACHABLE_CODE = YES;
10391055
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
10401056
CODE_SIGN_IDENTITY = "iPhone Developer";
1041-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
1057+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
10421058
COPY_PHASE_STRIP = NO;
10431059
CURRENT_PROJECT_VERSION = 1;
10441060
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -1071,7 +1087,7 @@
10711087
SKIP_INSTALL = YES;
10721088
SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
10731089
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1074-
SWIFT_VERSION = 3.0;
1090+
SWIFT_VERSION = 4.0;
10751091
TARGETED_DEVICE_FAMILY = "1,2";
10761092
VERSIONING_SYSTEM = "apple-generic";
10771093
VERSION_INFO_PREFIX = "";
@@ -1097,7 +1113,7 @@
10971113
CLANG_WARN_UNREACHABLE_CODE = YES;
10981114
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
10991115
CODE_SIGN_IDENTITY = "iPhone Distribution";
1100-
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
1116+
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
11011117
COPY_PHASE_STRIP = NO;
11021118
CURRENT_PROJECT_VERSION = 1;
11031119
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
@@ -1123,7 +1139,7 @@
11231139
SDKROOT = iphoneos;
11241140
SKIP_INSTALL = YES;
11251141
SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
1126-
SWIFT_VERSION = 3.0;
1142+
SWIFT_VERSION = 4.0;
11271143
TARGETED_DEVICE_FAMILY = "1,2";
11281144
VALIDATE_PRODUCT = YES;
11291145
VERSIONING_SYSTEM = "apple-generic";
@@ -1179,6 +1195,7 @@
11791195
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
11801196
PRODUCT_NAME = "$(TARGET_NAME)";
11811197
SDKROOT = iphoneos;
1198+
SWIFT_VERSION = 4.0;
11821199
};
11831200
name = Debug;
11841201
};
@@ -1223,6 +1240,7 @@
12231240
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
12241241
PRODUCT_NAME = "$(TARGET_NAME)";
12251242
SDKROOT = iphoneos;
1243+
SWIFT_VERSION = 4.0;
12261244
VALIDATE_PRODUCT = YES;
12271245
};
12281246
name = Release;
@@ -1285,7 +1303,8 @@
12851303
SKIP_INSTALL = YES;
12861304
SWIFT_INCLUDE_PATHS = "";
12871305
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1288-
SWIFT_VERSION = 3.0;
1306+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
1307+
SWIFT_VERSION = 4.0;
12891308
VERSIONING_SYSTEM = "apple-generic";
12901309
VERSION_INFO_PREFIX = "";
12911310
};
@@ -1342,7 +1361,8 @@
13421361
SDKROOT = macosx;
13431362
SKIP_INSTALL = YES;
13441363
SWIFT_INCLUDE_PATHS = "";
1345-
SWIFT_VERSION = 3.0;
1364+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
1365+
SWIFT_VERSION = 4.0;
13461366
VERSIONING_SYSTEM = "apple-generic";
13471367
VERSION_INFO_PREFIX = "";
13481368
};
@@ -1403,7 +1423,8 @@
14031423
PRODUCT_NAME = "$(TARGET_NAME)";
14041424
SDKROOT = macosx;
14051425
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1406-
SWIFT_VERSION = 3.0;
1426+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
1427+
SWIFT_VERSION = 4.0;
14071428
};
14081429
name = Debug;
14091430
};
@@ -1454,7 +1475,8 @@
14541475
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
14551476
PRODUCT_NAME = "$(TARGET_NAME)";
14561477
SDKROOT = macosx;
1457-
SWIFT_VERSION = 3.0;
1478+
SWIFT_SWIFT3_OBJC_INFERENCE = On;
1479+
SWIFT_VERSION = 4.0;
14581480
};
14591481
name = Release;
14601482
};
@@ -1476,6 +1498,7 @@
14761498
CLANG_WARN_UNREACHABLE_CODE = YES;
14771499
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
14781500
CODE_SIGN_IDENTITY = "iPhone Developer";
1501+
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
14791502
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
14801503
COPY_PHASE_STRIP = NO;
14811504
CURRENT_PROJECT_VERSION = 1;
@@ -1510,6 +1533,7 @@
15101533
SKIP_INSTALL = YES;
15111534
SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
15121535
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1536+
SWIFT_VERSION = 4.0;
15131537
TARGETED_DEVICE_FAMILY = 3;
15141538
TVOS_DEPLOYMENT_TARGET = 9.0;
15151539
VERSIONING_SYSTEM = "apple-generic";
@@ -1535,6 +1559,7 @@
15351559
CLANG_WARN_UNREACHABLE_CODE = YES;
15361560
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
15371561
CODE_SIGN_IDENTITY = "iPhone Distribution";
1562+
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
15381563
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
15391564
COPY_PHASE_STRIP = NO;
15401565
CURRENT_PROJECT_VERSION = 1;
@@ -1562,6 +1587,7 @@
15621587
SDKROOT = appletvos;
15631588
SKIP_INSTALL = YES;
15641589
SWIFT_INCLUDE_PATHS = $SRCROOT/zlib;
1590+
SWIFT_VERSION = 4.0;
15651591
TARGETED_DEVICE_FAMILY = 3;
15661592
TVOS_DEPLOYMENT_TARGET = 9.0;
15671593
VALIDATE_PRODUCT = YES;
@@ -1618,6 +1644,7 @@
16181644
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
16191645
PRODUCT_NAME = "$(TARGET_NAME)";
16201646
SDKROOT = appletvos;
1647+
SWIFT_VERSION = 4.0;
16211648
};
16221649
name = Debug;
16231650
};
@@ -1662,6 +1689,7 @@
16621689
PRODUCT_BUNDLE_IDENTIFIER = "io.socket.$(PRODUCT_NAME:rfc1034identifier)";
16631690
PRODUCT_NAME = "$(TARGET_NAME)";
16641691
SDKROOT = appletvos;
1692+
SWIFT_VERSION = 4.0;
16651693
VALIDATE_PRODUCT = YES;
16661694
};
16671695
name = Release;

Socket.IO-Client-Swift.xcodeproj/xcshareddata/xcschemes/SocketIO-Mac.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
language = ""
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<Testables>
4546
<TestableReference
@@ -69,6 +70,7 @@
6970
buildConfiguration = "Debug"
7071
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7172
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73+
language = ""
7274
launchStyle = "0"
7375
useCustomWorkingDirectory = "NO"
7476
ignoresPersistentStateOnLaunch = "NO"

Socket.IO-Client-Swift.xcodeproj/xcshareddata/xcschemes/SocketIO-iOS.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

Socket.IO-Client-Swift.xcodeproj/xcshareddata/xcschemes/SocketIO-tvOS.xcscheme

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0800"
3+
LastUpgradeVersion = "0900"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -40,6 +40,7 @@
4040
buildConfiguration = "Debug"
4141
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
4242
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
43+
language = ""
4344
shouldUseLaunchSchemeArgsEnv = "YES">
4445
<Testables>
4546
<TestableReference
@@ -69,6 +70,7 @@
6970
buildConfiguration = "Debug"
7071
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
7172
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
73+
language = ""
7274
launchStyle = "0"
7375
useCustomWorkingDirectory = "NO"
7476
ignoresPersistentStateOnLaunch = "NO"

SocketIO-MacTests/SocketObjectiveCTest.m

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ - (void)testProperties {
3636
self.socket.nsp = @"/objective-c";
3737
self.socket.reconnects = false;
3838
self.socket.reconnectWait = 1;
39+
if (self.socket.status == SocketIOClientStatusConnected) { }
40+
if (self.socket.engine == NULL) { }
3941
}
4042

4143
- (void)testOnSyntax {

SocketIO-MacTests/SocketSideEffectTest.swift

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import XCTest
1010
@testable import SocketIO
11+
@testable import StarscreamSocketIO
1112

1213
class SocketSideEffectTest: XCTestCase {
1314
func testInitialCurrentAck() {

Source/SocketIO/Ack/SocketAckEmitter.swift

+2
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ public final class SocketAckEmitter : NSObject {
6565
/// Call to ack receiving this event.
6666
///
6767
/// - parameter items: An array of items to send when acking. Use `[]` to send nothing.
68+
@objc
6869
public func with(_ items: [Any]) {
6970
guard ackNum != -1 else { return }
7071

@@ -104,6 +105,7 @@ public final class OnAckCallback : NSObject {
104105
/// - parameter after: The number of seconds before this emit times out if an ack hasn't been received.
105106
/// - parameter callback: The callback called when an ack is received, or when a timeout happens.
106107
/// To check for timeout, use `SocketAckStatus`'s `noAck` case.
108+
@objc
107109
public func timingOut(after seconds: Double, callback: @escaping AckCallback) {
108110
guard let socket = self.socket, ackNumber != -1 else { return }
109111

Source/SocketIO/Client/SocketAnyEvent.swift

+2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ public final class SocketAnyEvent : NSObject {
2929
// MARK: Properties
3030

3131
/// The event name.
32+
@objc
3233
public let event: String
3334

3435
/// The data items for this event.
36+
@objc
3537
public let items: [Any]?
3638

3739
/// The description of this event.

0 commit comments

Comments
 (0)