From fe86ec01176ea3365ffa2d04a2bb6dd7a9e6c01e Mon Sep 17 00:00:00 2001 From: Rob Nadin Date: Sat, 25 Sep 2021 10:49:32 +0100 Subject: [PATCH] Add Swift Package Manager support --- Package.swift | 25 +++++++++++++++++++ .../Internal/Delegate/SRDelegateController.h | 4 +++ .../Internal/NSRunLoop+SRWebSocketPrivate.h | 4 +++ .../NSURLRequest+SRWebSocketPrivate.h | 4 +++ .../Security/SRPinningSecurityPolicy.h | 4 +++ SocketRocket/include/NSRunLoop+SRWebSocket.h | 1 + .../include/NSURLRequest+SRWebSocket.h | 1 + SocketRocket/include/SRSecurityPolicy.h | 1 + SocketRocket/include/SRWebSocket.h | 1 + 9 files changed, 45 insertions(+) create mode 100644 Package.swift create mode 120000 SocketRocket/include/NSRunLoop+SRWebSocket.h create mode 120000 SocketRocket/include/NSURLRequest+SRWebSocket.h create mode 120000 SocketRocket/include/SRSecurityPolicy.h create mode 120000 SocketRocket/include/SRWebSocket.h diff --git a/Package.swift b/Package.swift new file mode 100644 index 000000000..92e78ea87 --- /dev/null +++ b/Package.swift @@ -0,0 +1,25 @@ +// swift-tools-version:5.0 +import PackageDescription + +let package = Package( + name: "SocketRocket", + platforms: [ + .iOS(.v9), + .macOS(.v10_10), + .tvOS(.v9), + ], + products: [ + .library( + name: "SocketRocket", + targets: ["SocketRocket"]), + ], + dependencies: [], + targets: [ + .target( + name: "SocketRocket", + path: "SocketRocket", + cSettings: [ + .headerSearchPath("Internal/**"), + ]), + ] +) diff --git a/SocketRocket/Internal/Delegate/SRDelegateController.h b/SocketRocket/Internal/Delegate/SRDelegateController.h index 43634a120..8918fd679 100644 --- a/SocketRocket/Internal/Delegate/SRDelegateController.h +++ b/SocketRocket/Internal/Delegate/SRDelegateController.h @@ -9,7 +9,11 @@ #import +#if SWIFT_PACKAGE +#import "SRWebSocket.h" +#else #import +#endif NS_ASSUME_NONNULL_BEGIN diff --git a/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h b/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h index 098f7a818..c841c2f9c 100644 --- a/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h +++ b/SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h @@ -7,7 +7,11 @@ // of patent rights can be found in the PATENTS file in the same directory. // +#if SWIFT_PACKAGE +#import "NSRunLoop+SRWebSocket.h" +#else #import +#endif // Empty function that force links the object file for the category. extern void import_NSRunLoop_SRWebSocket(void); diff --git a/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h b/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h index b09dde420..6cab93df4 100644 --- a/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h +++ b/SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h @@ -7,7 +7,11 @@ // of patent rights can be found in the PATENTS file in the same directory. // +#if SWIFT_PACKAGE +#import "NSURLRequest+SRWebSocket.h" +#else #import +#endif // Empty function that force links the object file for the category. extern void import_NSURLRequest_SRWebSocket(void); diff --git a/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h b/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h index 9b387317c..a6e42c3da 100644 --- a/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h +++ b/SocketRocket/Internal/Security/SRPinningSecurityPolicy.h @@ -9,7 +9,11 @@ #import +#if SWIFT_PACKAGE +#import "SRSecurityPolicy.h" +#else #import +#endif NS_ASSUME_NONNULL_BEGIN diff --git a/SocketRocket/include/NSRunLoop+SRWebSocket.h b/SocketRocket/include/NSRunLoop+SRWebSocket.h new file mode 120000 index 000000000..13d7e5fa2 --- /dev/null +++ b/SocketRocket/include/NSRunLoop+SRWebSocket.h @@ -0,0 +1 @@ +../NSRunLoop+SRWebSocket.h \ No newline at end of file diff --git a/SocketRocket/include/NSURLRequest+SRWebSocket.h b/SocketRocket/include/NSURLRequest+SRWebSocket.h new file mode 120000 index 000000000..d200ba731 --- /dev/null +++ b/SocketRocket/include/NSURLRequest+SRWebSocket.h @@ -0,0 +1 @@ +../NSURLRequest+SRWebSocket.h \ No newline at end of file diff --git a/SocketRocket/include/SRSecurityPolicy.h b/SocketRocket/include/SRSecurityPolicy.h new file mode 120000 index 000000000..edce484a0 --- /dev/null +++ b/SocketRocket/include/SRSecurityPolicy.h @@ -0,0 +1 @@ +../SRSecurityPolicy.h \ No newline at end of file diff --git a/SocketRocket/include/SRWebSocket.h b/SocketRocket/include/SRWebSocket.h new file mode 120000 index 000000000..7c92ce0e9 --- /dev/null +++ b/SocketRocket/include/SRWebSocket.h @@ -0,0 +1 @@ +../SRWebSocket.h \ No newline at end of file