Class
RateLimiter
Tracks App Store Connect API rate limits and enforces backoff.
actor RateLimiterOverview
Reads X-Rate-Limit headers from responses and delays requests when approaching the hourly threshold (default: pause at 90% usage).
Apple’s rate limit header format:
X-Rate-Limit: user-hour-lim:3500;user-hour-rem:2998Usage
let limiter = RateLimiter()
// Before each API request:
await limiter.throttleIfNeeded()
// After each response:
await limiter.update(from: responseHeaders)Topics
Initializers
init(throttleThreshold: Double)Creates a
RateLimiter.
Instance Properties
let throttleThreshold: DoubleThe fraction of the limit at which throttling begins (0.9 = 90% used).
Instance Methods
func throttleIfNeeded() asyncDelay execution if the rate limit is approaching the throttle threshold.
func update(from: [String : String])Update rate limit state from an HTTP response’s headers.
Default Implementations
Relationships
Conforms To
Swift.SendableSwift.SendableMetatype_Concurrency.Actor