Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

fuziki/cronet-xcframework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cronet-xcframework

Platform Language Swift Package Manager compatible Xcode

cronet-xcframework is xcframework wrapper for Cronet.
Supports installation via Swift Package Manager.

Cronet is the networking stack of Chromium put into a library for use on mobile.
This is the same networking stack that is used in the Chrome browser by over a billion people.
It offers an easy-to-use, high performance, standards-compliant, and secure way to perform HTTP requests.
https://chromium.googlesource.com/chromium/src/+/master/components/cronet

Warning
Cronet does not support bitcode.

Links

Installation

Add cronet-xcframework to a Package.swift manifest.

let package = Package(
    // ...
    dependencies: [
        .package(url: "https://github.com/fuziki/cronet-xcframework", exact: "104.0.5112-8"),
    ],
    targets: [
        .target(
            name: "MyLibrary",
            dependencies: [
                .product(name: "Cronet", package: "cronet-xcframework")
            ]),
    ]
)

Usage

Setup

Cronet.setQuicEnabled(true)

Cronet.start()

Cronet.registerHttpProtocolHandler() // setup for URLSession.shared
// ↑ or ↓
let configuration = URLSessionConfiguration.default
Cronet.install(into: configuration)

See Cronet.h↓ for more opsions.
https://chromium.googlesource.com/chromium/src/+/master/components/cronet/ios/Cronet.h

Request

let session = URLSession.shared
// ↑ or ↓
let session = URLSession(configuration: configuration)

let response: (Data, URLResponse) = try await session.data(from: url)

About

cronet-xcframework is xcframework wrapper for Cronet. Supports installation via Swift Package Manager.

Resources

License

Stars

Watchers

Forks