Browse Questions
  • Use separate Xcode Schemes, Build Configurations, Bundle Identifiers, and Firebase plists — one set per environment.
  • URLCache stores responses from network requests in memory and/or on disk.
  • Secure Session is Themis's stateful encrypted channel: peers perform a handshake, derive ephemeral session keys, and then exchange messages with forward secrecy over any transport you supply.
  • UIViewPropertyAnimator is an object that owns an animation, which makes that animation interruptible, reversible, and scrubbable.

Answer: URLCache stores responses from network requests in memory and/or on disk. It respects HTTP cache headers (Cache-Control, ETag, Expires) automatically.

Code Example:

// Configure a larger cache at app startup
URLCache.shared = URLCache(
    memoryCapacity: 50 * 1024 * 1024,  // 50MB memory
    diskCapacity: 200 * 1024 * 1024,   // 200MB disk
    directory: nil
)

// Control caching per request
var request = URLRequest(url: url)
request.cachePolicy = .returnCacheDataElseLoad  // use cache, fall back to network

// Cache policies:
// .useProtocolCachePolicy     — default, follows HTTP headers
// .reloadIgnoringLocalCache   — always hits network
// .returnCacheDataElseLoad    — use cache, only fetch if not cached
// .returnCacheDataDontLoad    — only use cache, never fetch (offline mode)

// Manually store a response
let cachedResponse = CachedURLResponse(response: response, data: data)
URLCache.shared.storeCachedResponse(cachedResponse, for: request)