A replacement of Apple's URLSession

Overview

AsyncURLSession

Apple brought us a very shiny feature async. And URLSession supported it at once. But you can't use downloadTask with async. So this package can help you deal with this kind of problem.

Without Progress

let (url, response) = try await AsyncURLSession.shared.url(from: .init(string: "https://filesamples.com/samples/document/txt/sample1.txt")!)

In this case AsyncURLSession will provide you a system url which is the downloaded file path.

With Progress

let (progress, response) = try await AsyncURLSession.shared.download(from: .init(string: "https://filesamples.com/samples/document/txt/sample1.txt")!, location: url)
let all = response.expectedContentLength

for try await current in progress {
    let progress = Double(current) / Double(all)

    print(Int(progress * 100), "%")
}

In this case, you need to provide a url where you file will be donwloaded to.

Others

  1. Both support URL and URLRequest
  2. You can create your custom AsyncURLSession
  3. Can use on Linux (not be tested, but I suppose to)
You might also like...
straightforward networking and error handling with async-await and URLSession

AsyncAwaitNetworkingPlayground How To Run Just clone the project, open it and run. Some notes about AsyncAwaitNetworkingPlayground It's a straightforw

GeminiProtocol - URLSession support for the Gemini Protocol

GeminiProtocol Network.Framework and URLSession support for the Gemini Protocol

API-TableView-Swift - API call with URLSession and show data to TableView with swift
API-TableView-Swift - API call with URLSession and show data to TableView with swift

API-TableView-Swift API call with URLSession and show data to TableView with swi

IOS mobile application that uses URLSession and Firebase
IOS mobile application that uses URLSession and Firebase

DogApp IOS mobile application that uses URLSession and Firebase. First a dog ima

๐Ÿคต๐Ÿฝโ€โ™€๏ธ Janet โ€” A thin HTTP networking layer built on URLSession for simple, declarative endpoint specification leveraging the power of async/await.

๐Ÿคต๐Ÿฝโ€โ™€๏ธ Janet โ€” Just another networking kit โ€” A thin HTTP networking layer built on URLSession for simple, declarative endpoint specification leveragi

Developed with use Swift language. As a third party library used SDWebImage. JSON parsing using URLSession with TMDB API. This app provide by the Core Data structure.

Capstone Project ๐ŸŽฏ About Developed with use Swift language. As a third party library used SDWebImage. JSON parsing using URLSession with TMDB API. Ad

A community-driven replacement for JSQMessagesViewController
A community-driven replacement for JSQMessagesViewController

A community-driven replacement for JSQMessagesViewController https://messagekit.github.io Goals Provide a ๐Ÿšจ safe ๐Ÿšจ environment for others to learn a

Linenoise-Swift  A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement.
Linenoise-Swift A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement.

Linenoise-Swift A pure Swift implementation of the Linenoise library. A minimal, zero-config readline replacement. Supports Mac OS and Linux Line edit

Realm is a mobile database: a replacement for Core Data & SQLite

Realm is a mobile database that runs directly inside phones, tablets or wearables. This repository holds the source code for the iOS, macOS, tvOS & wa

DeviceKit is a value-type replacement of UIDevice.
DeviceKit is a value-type replacement of UIDevice.

DeviceKit is a value-type replacement of UIDevice.

FileManager replacement for Local, iCloud and Remote (WebDAV/FTP/Dropbox/OneDrive) files -- Swift
FileManager replacement for Local, iCloud and Remote (WebDAV/FTP/Dropbox/OneDrive) files -- Swift

This Swift library provide a swifty way to deal with local and remote files and directories in a unified way. This library provides implementaion of W

Replacement for Apple's Reachability re-written in Swift with closures
Replacement for Apple's Reachability re-written in Swift with closures

Reachability.swift Reachability.swift is a replacement for Apple's Reachability sample, re-written in Swift with closures. It is compatible with iOS (

Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

UILabel drop-in replacement supporting Hashtags
UILabel drop-in replacement supporting Hashtags

ActiveLabel.swift UILabel drop-in replacement supporting Hashtags (#), Mentions (@), URLs (http://), Emails and custom regex patterns, written in Swif

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

Swift TTTAttributedLabel replacement

Nantes ๐Ÿฅ• This library is a Swift port/fork of the popular Objective-C library TTTAttributedLabel. Much โค๏ธ and credit goes to Mattt for creating such

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

LRUCache is an open-source replacement for NSCache that behaves in a predictable, debuggable way

Introduction Installation Usage Concurrency Performance Credits Introduction LRUCache is an open-source replacement for NSCache that behaves in a pred

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Releases(v1.0.0)
Owner
Underthestars-zhy
iOS software developer
Underthestars-zhy
A replacement of Apple's URLSession

AsyncURLSession Apple brought us a very shiny feature async. And URLSession supported it at once. But you can't use downloadTask with async. So this p

Underthestars-zhy 1 Apr 8, 2022
A replacement for as which runs in constant time instead of O(n) when the conformance is not satisfiedA replacement for as which runs in constant time instead of O(n) when the conformance is not satisfied

ZConform A replacement for as? which runs in constant time instead of O(n) when the conformance is not satisfied. How it works ZConform does a one-tim

Emerge Tools 20 Aug 4, 2022
Mock Alamofire and URLSession requests without touching your code implementation

Mocker is a library written in Swift which makes it possible to mock data requests using a custom URLProtocol. Features Requirements Usage Activating

WeTransfer 898 Dec 26, 2022
Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application.

Another network wrapper for URLSession. Built to be simple, small and easy to create tests at the network layer of your application. Install Carthage

Ronan Rodrigo Nunes 89 Dec 26, 2022
A reactive library for using URLSession

Reactive wrapper for URLSession using Combine. At its core, the library consist of the NetworkServiceClient protocol along with a minimal implementation NetworkService.

MFB Technologies, Inc. 2 Nov 20, 2022
A swift network profiler built on top of URLSession.

By Xmartlabs SRL. Introduction Xniffer is a non-intrusive framework for intercepting outgoing requests and their responses between your app and any ex

xmartlabs 498 Dec 24, 2022
Backward compatible async/await for URLSession!

URLSessionBackport URLSessionBackport aims to make it possible to use URLSession's new async/await syntax on older OSs, namely iOS 13 or macOS 10.15 a

Mochi Development, Inc. 39 Sep 21, 2022
Write clean, concise and declarative network code relying on URLSession, with the power of RxSwift. Inspired by Retrofit.

ReactiveAPI Reactive API library allows you to write clean, concise and declarative network code, with the power of RxSwift and URLSession! iOS Demo A

Sky UK Ltd 79 Nov 19, 2022
Use this package in order to ease up working with Combine URLSession.

Use this package in order to ease up working with Combine URLSession. We support working with Codable for all main HTTP methods GET, POST, PUT and DELETE. We also support MultipartUpload

Daniel Mandea 1 Jan 6, 2022
To practice URLSession to fetch json data from open weather API

โ›…๏ธ weatherApp-iOS-practice ?? ๊ธฐ๋Šฅ ์ƒ์„ธ ๋„์‹œ ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜๋ฉด ํ˜„์žฌ ๋‚ ์”จ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์™€ ํ™”๋ฉด์— ํ‘œ์‹œ๋˜๊ฒŒ ๋งŒ๋“ค์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค

Jacob Ko 0 Dec 18, 2021