Swiftpack.co - Package - apple/swift-nio-transport-services

NIO Transport Services

Extensions for SwiftNIO to support Apple platforms as first-class citizens.

About NIO Transport Services

NIO Transport Services is an extension to SwiftNIO that provides first-class support for Apple platforms by using Network.framework to provide network connectivity, and Dispatch to provide concurrency. NIOTS provides an alternative EventLoop, EventLoopGroup, and several alternative Channels and Bootstraps.

In addition to providing first-class support for Apple platforms, NIO Transport Services takes advantage of the richer API of Network.framework to provide more insight into the behaviour of the network than is normally available to NIO applications. This includes the ability to wait for connectivity until a network route is available, as well as all of the extra proxy and VPN support that is built directly into Network.framework.

All regular NIO applications should work just fine with NIO Transport Services, simply by changing the event loops and bootstraps in use.

Why Transport Services?

Network.framework is Apple's reference implementation of the proposed post-sockets API that is currently being worked on by the Transport Services Working Group (taps) of the IETF. To indicate the proposed long-term future of interfaces like Network.framework, we decided to call this module NIOTransportServices. Also, NIONetworkFramework didn't appeal to us much as a name.

How to Use?

NIO Transport Services primarily uses SwiftPM as its build tool, so we recommend using that as well. If you want to depend on NIO Transport Services in your own project, it's as simple as adding a dependencies clause to your Package.swift:

dependencies: [
    .package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.1.1")

and then adding the NIOTransportServices module to your target dependencies.

If your project is set up as an Xcode project and you're using Xcode 11+, you can add NIO Transport Services as a dependency to your Xcode project by clicking File -> Swift Packages -> Add Package Dependency. In the upcoming dialog, please enter https://github.com/apple/swift-nio-transport-services.git and click Next twice. Finally, make sure NIOTransportServices is selected and click finish. Now will be able to import NIOTransportServices in your project.

You can also use SwiftNIO Transport Services in an iOS project through CocoaPods:

pod 'SwiftNIO', '~> 2.0.0'
pod 'SwiftNIOTransportServices', '~> 1.0.0'

If you want to develop SwiftNIO with Xcode 10, you have to generate an Xcode project:

swift package generate-xcodeproj

and add the project as a sub-project by dragging it into your iOS project and adding the framework (NIOTransportServices.framework) in 'Build Phases' -> 'Link Binary Libraries'.

Do note however that Network.framework requires macOS 10.14+, iOS 12+, or tvOS 12+.


Just like the rest of the SwiftNIO family, swift-nio-transport-services follows SemVer 2.0.0 with a separate document declaring SwiftNIO's Public API.

swift-nio-transport-services 1.x

swift-nio-transport-services versions 1.x is part of the SwiftNIO 2 family of repositories and does not have any dependencies besides swift-nio, Swift 5, and an Apple OS supporting Network.framework. As the latest version, it lives on the master branch.

To depend on swift-nio-transport-services, put the following in the dependencies of your Package.swift:

.package(url: "https://github.com/apple/swift-nio-transport-services.git", from: "1.0.0"),

swift-nio-transport-services 0.x

The legacy swift-nio-transport-services 0.x is part of the SwiftNIO 1 family of repositories and works with Swift 4.1 and newer. The source code can be found on the swift-nio-transport-services-swift-4-maintenance branch.

Developing NIO Transport Services

For the most part, NIO Transport Services development is as straightforward as any other SwiftPM project. With that said, we do have a few processes that are worth understanding before you contribute. For details, please see CONTRIBUTING.md in this repository.

Please note that all work on NIO Transport Services is covered by the SwiftNIO Code of Conduct.


Stars: 144


Used By

Total: 0


SwiftNIO TransportServices 1.4.0 - 2020-03-24 17:31:32

SemVer Minor

  • universal bootstrap (#69)

SemVer Patch

  • Stop syncing onto queues (#71)

SwiftNIO Transport Services 1.3.0 - 2019-12-10 12:40:44

Semver Minor

  • Updated minimum NIO dependency to 2.11.0 to remove compiler warnings and adopt new, faster atomics. (#67)
  • Added a missing code of conduct. (#66)

SwiftNIO TransportServices 1.2.1 - 2019-11-07 17:59:22

SemVer Patch

  • fixed warnings that come with SwiftNIO 2.9.0

SwiftNIO TransportServices 1.2.0 - 2019-10-24 00:42:50

SemVer Minor

  • Add a bind timeout. (#54)
  • Namespace ChannelOptions. (#61)

SemVer Patch

  • Update Readme to recommend using Xcode package support (#59, patch credit to @tkrajacic)
  • Add .swiftpm to gitignore (#58, patch credit to @tkrajacic)
  • Bootstrap: test that returning futures from foreign ELs are okay (#55)

SwiftNIO Transport Services 1.1.1 - 2019-07-24 18:59:56

SemVer Patch

  • Correctly autoRead through the pipeline (#52)

SwiftNIO Transport Services 1.1.0 - 2019-07-22 16:54:36

Semver Minor

  • Made NIOTransportServices available on watchOS 6. (#47)
  • Made it possible to initialise channels using NIOTSConnectionBootstrap and NIOTSListenerBootstraps with EventLoopGroup to ensure that they may be localised to a specific event loop. (#49)

Semver Patch

  • Fixed warnings regarding to .url endpoint type. (#48, #51)
  • Enabled TCP_NODELAY by default on all channels. (#46)

SwiftNIO Transport Services 1.0.3 - 2019-05-22 17:23:01

Semver Patch

  • Fixed an issue where NWConnection objects would be sent down the NIOTSListenerChannel pipeline instead of Channel objects. (#45)

SwiftNIO TransportServices 1.0.2 - 2019-05-17 11:07:10

SemVer Patch

  • Annotate code with availability attributes (#42)

SwiftNIO Transport Services 1.0.1 - 2019-05-02 14:30:34

Semver Patch

  • Fix a bug where setting multiple channel options of the same type would silently forget all but the last. (#40)
  • Removed unnecessary preconditions that could lead to crashes. (#37)
  • Readme updates. (#34)
  • Podspec updates. (#33)

SwiftNIO Transport Services 0.5.3 - 2019-05-01 13:51:53

Semver Patch

  • Allow setting multiple socket options. (#41)

SwiftNIO Transport Services 0.5.2 - 2019-04-19 08:07:53

SemVer Patch

  • fixed some warnings
  • added @unknown default cases for NWEndpoint which suddenly became an open enum

SwiftNIO Transport Services 1.0.0 - 2019-04-01 16:04:38

See our blog post announcing the release of the SwiftNIO 2 family.

SwiftNIO Transport Services 0.5.1 - 2019-02-12 13:15:16

Semver Patch

  • Updated podspec to correctly exclude versions of SwiftNIO below 1.11 (#25)

SwiftNIO Transport Services 0.5.0 - 2019-02-08 22:49:04

Semver Minor

  • Added NIOTSChannelOptions.enablePeerToPeer to enable peer-to-peer connectivity for bonjour networking.

SwiftNIO Transport Services 0.4.0 - 2018-12-06 16:39:30

Semver Minor

  • Added support for opting-out of using Network.framework's .waiting state on a per-Channel basis. (#15)

Semver Patch

  • Fixed a number of thread-safety issues. (#16, #17)

SwiftNIO Transport Services 0.3.1 - 2018-11-15 16:27:29

  • Produce better diagnostics when users use an unsupported ChannelOption. (#12)
  • Removed an invalid assertion causing unreasonable crashes. (#13)

SwiftNIO Transport Services 0.3.0 - 2018-11-06 17:47:45

  • Fixed issues where inEventLoop would be used as the basis of an assertion, which could fail spuriously, by adopting SwiftNIO 1.11 and its assertInEventLoop pattern. (#11)
  • Fixed an issue where the promise for bind could go missing. (#9)
  • Code cleanups. (#7)

SwiftNIO Transport Services 0.2.1 - 2018-09-12 11:42:01

SemVer Patch

  • Add Cocoapods podspec generation.

SwiftNIO Transport Services 0.2.0 - 2018-08-10 12:31:50


Please note, as we are before version 1.0 there is no semantic versioning in this package

  • Added support for SO_REUSEADDR and SO_REUSEPORT. (#1)
  • Fixed assertions occurring when errors fire during channel setup. (#2)