I want to implement my API’s hitting mechanism to use HTTP2/3 using QUIC as their transport layer, which provides benefits for reduce latency and improved multiplexing.
I am using Cronet in android native app using java. Same i want to use in my iOS native app using Swift.
Cronet’s usage in swift app is not explained anywhere in web.
I am using this library Cronet.framework
and its implementation i found is this.
Add in Podfile and do pod install in terminal.
pod 'Cronet'
then in AppDelegate
import Cronet
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
setupCronet()
return true
}
private func setupCronet() {
Cronet.setHttp2Enabled(true)
Cronet.setQuicEnabled(true)
Cronet.setBrotliEnabled(true)
Cronet.setHttpCacheType(.memory)
Cronet.start()
Cronet.registerHttpProtocolHandler()
}
}
But there is no other implementation in project to call like in Android we call CronetEngine and then to call the api’s.
Question is:
-
Do i need to use URLSession for network calls as usual and it will use cronet. (I don’t think so)
-
The other thought is Apple’s URLSession in latest version of iOS supports Http2/3 using QUIC itself(precondition, the HTTP server supports QUIC protocol) and we do not need to use Cronet like we did in android?????