This is an example of an elegant, extensible network stack in Swift.
You can find an explanation of all the code in these two blog posts:
There is not dependency management on this project and there never will be. Please copy paste this code into your project to use it. Then, it's your code. You can add to it and edit it as you see fit. This isn't designed to be a third-party library but instead help you get started on your own networking stack.