A collection of socket utilities in pure Swift
SwifterSockets is part of Swiftfire, the server for websites build with Swift.
- Shields the Swift application from the complexity of the Unix socket calls.
- Directly interfaces with the POSIX calls using:
- connectToTipServer
- tipTransfer
- tipReceiverLoop
- tipAccept
- setupTipServer
- Implements a framework on top of the POSIX calls with:
- Connection (class)
- connectToTipServer (returns a connection)
- TipServer (class, produces connections)
- Includes replacements for the FD_SET, FD_CLR, FD_ZERO and FD_ISSET macro's.
- Builds as a library using the Swift Package Manager (SPM)
If you need secure connections, check out SecureSockets. SecureSockets is build on top of SwifterSockets (and OpenSSL).
The reference manual is hosted at Swiftfire.nl
SwifterSockets is distributed as a Swift package and as a framework.
Extend the dependency of your project package with:
dependencies: [
...
.package(url: "https://github.com/Balancingrock/SwifterSockets", from: <version-number>)
]
The must be replaced with the version number that must be used, for example: "1.0.0".
First clone SwifterSockets and the create the Xcode project:
At the command line:
$ git clone https://github.com/Balancingrock/SwifterSockets
$ cd SwifterSockets
$ swift package generate-xcodeproj
Double click that project to open it. Once open set the Defines Module
to 'yes' in the Build Settings
before creating the framework. (Otherwise the import of the framework in another project won't work)
In the project that will use SwifterSockets, add the SwifterSockets.framework by opening the General
settings of the target and add the SwifterSockets.framework to the Embedded Binaries
.
In the Swift source code import SwifterSockets by "import SwifterSockets" at the top of the file.
Note: Planned releases are for information only, they are subject to change without notice.
- No new features planned. Features and bugfixes will be made on an ad-hoc basis as needed to support Swiftfire development.
- For feature requests and bugfixes please contact rien@balancingrock.nl
- Restructured for Swiftfire 1.0.0