- Current status: native
URLSessionclient is used for requests andprefetch()(with an in‑memory cache for fresh results). Auto‑prefetch on app start is Android‑only. - Auto‑prefetch on app start is available. Call
NitroAutoPrefetcher.prefetchOnStart()fromAppDelegateto trigger it. - Cronet integration is planned; once available, the iOS client will switch to Cronet for parity with Android.
nitroFetchOnWorkletruns the mapper on the JS thread on iOS (off‑thread mapping requires Android worklets runtime).
See also: docs/cronet-ios.md for high-level Cronet iOS integration notes.
- Schedule from JS at runtime (same as Android):
import { prefetchOnAppStart } from 'react-native-nitro-fetch';
await prefetchOnAppStart('https://httpbin.org/uuid', { prefetchKey: 'uuid' });- Trigger native prefetch on app start in
AppDelegate.swift:
import NitroFetch
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
NitroAutoPrefetcher.prefetchOnStart()
return true
}
}Notes
- Prefetch is best‑effort.
- Responses served shortly after prefetch include header
nitroPrefetched: true.