Swiftpack.co - mochidev/URLSessionBackport as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mochidev.
mochidev/URLSessionBackport 0.2.0
Backward compatible async/await for URLSession!
⭐️ 36
🕓 2 years ago
iOS macOS watchOS
.package(url: "https://github.com/mochidev/URLSessionBackport.git", from: "0.2.0")

URLSessionBackport

Test Status

URLSessionBackport aims to make it possible to use URLSession's new async/await syntax on older OSs, namely iOS 13 or macOS 10.15 and newer. Note that Xcode 13.2 is required, as that version contains the necessary back-ported async/await libraries.

Installation

Add URLSessionBackport as a dependency in your Package.swift file to start using it. Then, add import URLSessionBackport to any file you wish to use the library in.

Please check the releases for recommended versions.

dependencies: [
    .package(url: "https://github.com/mochidev/URLSessionBackport.git", .upToNextMinor(from: "1.0.0")),
],
...
targets: [
    .target(
        name: "MyPackage",
        dependencies: [
            "URLSessionBackport",
        ]
    )
]

What is URLSessionBackport?

URLSessionBackport adds a single property to your URLSession instances: .backport. The best part? Within this namespace, URLSession's async/await methods have been magically re-implemented, allowing you access to them on iOS 13 or macOS 10.15 and newer! Additionally, the methods are automatically marked as deprecated, so they'll let you know when it's safe to remove them.

Contributing

Contribution is welcome! Please take a look at the issues already available, or start a new issue to discuss a new feature. Although guarantees can't be made regarding feature requests, PRs that fit with the goals of the project and that have been discussed before-hand are more than welcome!

Please make sure that all submissions have clean commit histories, are well documented, and thoroughly tested. Please rebase your PR before submission rather than merge in main. Linear histories are required.

GitHub

link
Stars: 36
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

0.2.0
2 years ago

What's Changed

Hopefully with the next round of PRs (tests), I can call this a 1.0 🎉

Full Changelog: https://github.com/mochidev/URLSessionBackport/compare/0.1.1...0.2.0

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