Swiftpack.co - swift-kipple/Networking as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by swift-kipple.
swift-kipple/Networking 0.3.4
A Swift cross-platform (Apple and Linux) networking library.
⭐️ 11
🕓 3 weeks ago
iOS macOS watchOS tvOS linux macOS iOS
.package(url: "https://github.com/swift-kipple/Networking.git", from: "0.3.4")

KippleNetworking

CI Status Latest Release Swift Compatibility Platform Compatibility License

A Swift library that offers cross-platform (Apple and Linux) networking support, intended for the creation of cross-platform SDKs to be used in projects spanning across iOS/macOS/tvOS/watchOS and Server-side Swift.

:warning: The code in this library has been made public as-is for the purposes of education, discovery, and personal use. It is NOT production-ready; however, if you're interested in leveraging this library as a dependency for your own projects, feel free to do so (at your own risk) and open GitHub issues for any problems you encounter and I will do my best to provide support.

ToDo

General

  • Ensure public classes are documented (use SwiftLint to trigger warnings).
  • Abstract client implementation for injection. (eg. to allow other clients to be injected / used as dispatcher.)
  • Improve package dependencies for various platforms (eg. default to only including Foundation on Apple platforms unless some flag is set)? Example: 'condition: .when(platforms: [.linux])' to check for Linux-only dependencies, but only for Release mode.

Testing

  • Implement POST and PUT tests.
  • Implement HTML tests.
  • Implement file upload and download tests.
  • Implement tests for HTTPClient.
  • Implement tests for rootResponseKey.
  • Implement tests for headers and parameters.

Convenience

  • On Apple platforms, all direct passing of URLRequest into HTTPClient. Example:
extension HTTPClient {
    #if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
    public func request(for urlRequest: URLRequest) async throws -> Data {
        let request = urlRequest.asKippleRequest()
        return try await self.request(request)
    }
    
    public func request<T>(for urlRequest: URLRequest) async throws -> DataResponse<T> where T: Decodable {
        let request = urlRequest.asKippleRequest()
        return try await self.request(request)
    }
    #endif
}

GitHub

link
Stars: 11
Last commit: 3 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics