Skip to content

Latest commit

 

History

History
37 lines (26 loc) · 1.31 KB

File metadata and controls

37 lines (26 loc) · 1.31 KB

iOS

  • Current status: native URLSession client is used for requests and prefetch() (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() from AppDelegate to trigger it.
  • Cronet integration is planned; once available, the iOS client will switch to Cronet for parity with Android.
  • nitroFetchOnWorklet runs 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.

Auto‑Prefetch on App Start

  1. Schedule from JS at runtime (same as Android):
import { prefetchOnAppStart } from 'react-native-nitro-fetch';
await prefetchOnAppStart('https://httpbin.org/uuid', { prefetchKey: 'uuid' });
  1. 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.