Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Swift Package Manager support #221

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// swift-tools-version: 5.6
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftSocket",
platforms: [
.iOS(.v9),
.macOS(.v10_10),
.tvOS(.v9)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SwiftSocket",
targets: [
"SwiftSocketC",
"SwiftSocket"
]
)
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftSocketC",
path: "Sources/C"
),
.target(
name: "SwiftSocket",
path: "Sources/Swift"
)
]
)
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ And run then `pod install`
github "swiftsocket/SwiftSocket"
```

## Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/swiftsocket/SwiftSocket", .upToNextMajor(from: "2.0.0"))
]
```

# Code examples

## Create client socket
Expand Down
Empty file added Sources/C/include/.gitkeep
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions SwiftSocket.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'SwiftSocket'
s.version = '2.0.2'
s.version = '2.2.0'
s.summary = 'A cool framework to work with TCP and UDP sockets'

s.description = <<-DESC
Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.author = { 'Dan Shevlyuk' => '[email protected]' }
s.social_media_url = 'http://twitter.com/danshevluk'

s.ios.deployment_target = '8.0'
s.ios.deployment_target = '9.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
s.source = {
Expand Down
96 changes: 48 additions & 48 deletions SwiftSocket.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,36 @@

/* Begin PBXBuildFile section */
3723138F1DCF84CA0042DA87 /* SwiftSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3723138D1DCF84CA0042DA87 /* SwiftSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
372313921DCF84D80042DA87 /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313901DCF84D80042DA87 /* UDPClient.swift */; };
372313931DCF84D80042DA87 /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313911DCF84D80042DA87 /* yudpsocket.c */; };
372313961DCF84E30042DA87 /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313941DCF84E30042DA87 /* TCPClient.swift */; };
372313971DCF84E30042DA87 /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313951DCF84E30042DA87 /* ytcpsocket.c */; };
3723139A1DCF84EC0042DA87 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313981DCF84EC0042DA87 /* Result.swift */; };
3723139B1DCF84EC0042DA87 /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313991DCF84EC0042DA87 /* Socket.swift */; };
3723139C1DCF85270042DA87 /* SwiftSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3723138D1DCF84CA0042DA87 /* SwiftSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
37454ED71E0615FE00800AE5 /* SwiftSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 3723138D1DCF84CA0042DA87 /* SwiftSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
37454ED81E06163C00800AE5 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313981DCF84EC0042DA87 /* Result.swift */; };
37454ED91E06163C00800AE5 /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313991DCF84EC0042DA87 /* Socket.swift */; };
37454EDA1E06163C00800AE5 /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313941DCF84E30042DA87 /* TCPClient.swift */; };
37454EDB1E06163C00800AE5 /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313951DCF84E30042DA87 /* ytcpsocket.c */; };
37454EDC1E06163C00800AE5 /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313901DCF84D80042DA87 /* UDPClient.swift */; };
37454EDD1E06163C00800AE5 /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313911DCF84D80042DA87 /* yudpsocket.c */; };
37454EDF1E06163D00800AE5 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313981DCF84EC0042DA87 /* Result.swift */; };
37454EE01E06163D00800AE5 /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313991DCF84EC0042DA87 /* Socket.swift */; };
37454EE11E06163D00800AE5 /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313941DCF84E30042DA87 /* TCPClient.swift */; };
37454EE21E06163D00800AE5 /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313951DCF84E30042DA87 /* ytcpsocket.c */; };
37454EE31E06163D00800AE5 /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 372313901DCF84D80042DA87 /* UDPClient.swift */; };
37454EE41E06163D00800AE5 /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 372313911DCF84D80042DA87 /* yudpsocket.c */; };
375C48301DDC4C56008C701D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 375C482F1DDC4C56008C701D /* AppDelegate.swift */; };
375C48321DDC4C56008C701D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 375C48311DDC4C56008C701D /* ViewController.swift */; };
375C48351DDC4C56008C701D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 375C48331DDC4C56008C701D /* Main.storyboard */; };
375C48371DDC4C56008C701D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 375C48361DDC4C56008C701D /* Assets.xcassets */; };
375C483A1DDC4C56008C701D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 375C48381DDC4C56008C701D /* LaunchScreen.storyboard */; };
4564C901288841CB00138EBD /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C8FF288841CB00138EBD /* Socket.swift */; };
4564C902288841CB00138EBD /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C8FF288841CB00138EBD /* Socket.swift */; };
4564C903288841CB00138EBD /* Socket.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C8FF288841CB00138EBD /* Socket.swift */; };
4564C904288841CB00138EBD /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C900288841CB00138EBD /* Result.swift */; };
4564C905288841CB00138EBD /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C900288841CB00138EBD /* Result.swift */; };
4564C906288841CB00138EBD /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C900288841CB00138EBD /* Result.swift */; };
4564C908288841D300138EBD /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C907288841D300138EBD /* TCPClient.swift */; };
4564C909288841D300138EBD /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C907288841D300138EBD /* TCPClient.swift */; };
4564C90A288841D300138EBD /* TCPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C907288841D300138EBD /* TCPClient.swift */; };
4564C90C288841DD00138EBD /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90B288841DD00138EBD /* UDPClient.swift */; };
4564C90D288841DD00138EBD /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90B288841DD00138EBD /* UDPClient.swift */; };
4564C90E288841DD00138EBD /* UDPClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90B288841DD00138EBD /* UDPClient.swift */; };
4564C910288841E400138EBD /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90F288841E400138EBD /* ytcpsocket.c */; };
4564C911288841E400138EBD /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90F288841E400138EBD /* ytcpsocket.c */; };
4564C912288841E400138EBD /* ytcpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C90F288841E400138EBD /* ytcpsocket.c */; };
4564C914288841EC00138EBD /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C913288841EC00138EBD /* yudpsocket.c */; };
4564C915288841EC00138EBD /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C913288841EC00138EBD /* yudpsocket.c */; };
4564C916288841EC00138EBD /* yudpsocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 4564C913288841EC00138EBD /* yudpsocket.c */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3723138C1DCF84CA0042DA87 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Sources/Info.plist; sourceTree = SOURCE_ROOT; };
3723138D1DCF84CA0042DA87 /* SwiftSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SwiftSocket.h; path = Sources/SwiftSocket.h; sourceTree = SOURCE_ROOT; };
372313901DCF84D80042DA87 /* UDPClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UDPClient.swift; path = Sources/UDPClient.swift; sourceTree = SOURCE_ROOT; };
372313911DCF84D80042DA87 /* yudpsocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yudpsocket.c; path = Sources/yudpsocket.c; sourceTree = SOURCE_ROOT; };
372313941DCF84E30042DA87 /* TCPClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TCPClient.swift; path = Sources/TCPClient.swift; sourceTree = SOURCE_ROOT; };
372313951DCF84E30042DA87 /* ytcpsocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ytcpsocket.c; path = Sources/ytcpsocket.c; sourceTree = SOURCE_ROOT; };
372313981DCF84EC0042DA87 /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Sources/Result.swift; sourceTree = SOURCE_ROOT; };
372313991DCF84EC0042DA87 /* Socket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Socket.swift; path = Sources/Socket.swift; sourceTree = SOURCE_ROOT; };
37454ECA1E06158200800AE5 /* SwiftSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
37454EE81E0617F300800AE5 /* Info-tvOS.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Info-tvOS.plist"; path = "Sources/Info-tvOS.plist"; sourceTree = SOURCE_ROOT; };
375C482D1DDC4C56008C701D /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand All @@ -55,6 +49,12 @@
375C483B1DDC4C56008C701D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
377DAA691DCDE40200009697 /* SwiftSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
377DAA761DCDE45D00009697 /* SwiftSocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftSocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
4564C8FF288841CB00138EBD /* Socket.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Socket.swift; path = Sources/Swift/Socket.swift; sourceTree = SOURCE_ROOT; };
4564C900288841CB00138EBD /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Result.swift; path = Sources/Swift/Result.swift; sourceTree = SOURCE_ROOT; };
4564C907288841D300138EBD /* TCPClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = TCPClient.swift; path = Sources/Swift/TCPClient.swift; sourceTree = SOURCE_ROOT; };
4564C90B288841DD00138EBD /* UDPClient.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = UDPClient.swift; path = Sources/Swift/UDPClient.swift; sourceTree = SOURCE_ROOT; };
4564C90F288841E400138EBD /* ytcpsocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ytcpsocket.c; path = Sources/C/ytcpsocket.c; sourceTree = SOURCE_ROOT; };
4564C913288841EC00138EBD /* yudpsocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = yudpsocket.c; path = Sources/C/yudpsocket.c; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -92,17 +92,17 @@
375BC51D1DCDE86B006AD8F6 /* TCPSocket */ = {
isa = PBXGroup;
children = (
372313941DCF84E30042DA87 /* TCPClient.swift */,
372313951DCF84E30042DA87 /* ytcpsocket.c */,
4564C907288841D300138EBD /* TCPClient.swift */,
4564C90F288841E400138EBD /* ytcpsocket.c */,
);
name = TCPSocket;
sourceTree = "<group>";
};
375BC51E1DCDE878006AD8F6 /* UDPSocket */ = {
isa = PBXGroup;
children = (
372313901DCF84D80042DA87 /* UDPClient.swift */,
372313911DCF84D80042DA87 /* yudpsocket.c */,
4564C90B288841DD00138EBD /* UDPClient.swift */,
4564C913288841EC00138EBD /* yudpsocket.c */,
);
name = UDPSocket;
sourceTree = "<group>";
Expand Down Expand Up @@ -154,8 +154,8 @@
5518C83119A329100049DC22 /* Source */ = {
isa = PBXGroup;
children = (
372313981DCF84EC0042DA87 /* Result.swift */,
372313991DCF84EC0042DA87 /* Socket.swift */,
4564C900288841CB00138EBD /* Result.swift */,
4564C8FF288841CB00138EBD /* Socket.swift */,
375BC51D1DCDE86B006AD8F6 /* TCPSocket */,
375BC51E1DCDE878006AD8F6 /* UDPSocket */,
377DAA6A1DCDE40200009697 /* Supporting Files */,
Expand Down Expand Up @@ -357,12 +357,12 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
37454EE31E06163D00800AE5 /* UDPClient.swift in Sources */,
37454EE01E06163D00800AE5 /* Socket.swift in Sources */,
37454EE41E06163D00800AE5 /* yudpsocket.c in Sources */,
37454EDF1E06163D00800AE5 /* Result.swift in Sources */,
37454EE21E06163D00800AE5 /* ytcpsocket.c in Sources */,
37454EE11E06163D00800AE5 /* TCPClient.swift in Sources */,
4564C916288841EC00138EBD /* yudpsocket.c in Sources */,
4564C90A288841D300138EBD /* TCPClient.swift in Sources */,
4564C90E288841DD00138EBD /* UDPClient.swift in Sources */,
4564C903288841CB00138EBD /* Socket.swift in Sources */,
4564C906288841CB00138EBD /* Result.swift in Sources */,
4564C912288841E400138EBD /* ytcpsocket.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -379,25 +379,25 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
372313931DCF84D80042DA87 /* yudpsocket.c in Sources */,
3723139A1DCF84EC0042DA87 /* Result.swift in Sources */,
3723139B1DCF84EC0042DA87 /* Socket.swift in Sources */,
372313921DCF84D80042DA87 /* UDPClient.swift in Sources */,
372313971DCF84E30042DA87 /* ytcpsocket.c in Sources */,
372313961DCF84E30042DA87 /* TCPClient.swift in Sources */,
4564C914288841EC00138EBD /* yudpsocket.c in Sources */,
4564C908288841D300138EBD /* TCPClient.swift in Sources */,
4564C90C288841DD00138EBD /* UDPClient.swift in Sources */,
4564C901288841CB00138EBD /* Socket.swift in Sources */,
4564C904288841CB00138EBD /* Result.swift in Sources */,
4564C910288841E400138EBD /* ytcpsocket.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
377DAA711DCDE45D00009697 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
37454EDC1E06163C00800AE5 /* UDPClient.swift in Sources */,
37454ED91E06163C00800AE5 /* Socket.swift in Sources */,
37454EDD1E06163C00800AE5 /* yudpsocket.c in Sources */,
37454ED81E06163C00800AE5 /* Result.swift in Sources */,
37454EDB1E06163C00800AE5 /* ytcpsocket.c in Sources */,
37454EDA1E06163C00800AE5 /* TCPClient.swift in Sources */,
4564C915288841EC00138EBD /* yudpsocket.c in Sources */,
4564C909288841D300138EBD /* TCPClient.swift in Sources */,
4564C90D288841DD00138EBD /* UDPClient.swift in Sources */,
4564C902288841CB00138EBD /* Socket.swift in Sources */,
4564C905288841CB00138EBD /* Result.swift in Sources */,
4564C911288841E400138EBD /* ytcpsocket.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down