1/9
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No study sessions yet.
What is URLSession in Swift?
URLSession is the primary API for networking. It supports data, upload, and download tasks. It handles caching, authentication, and background execution. Configurations define behavior. It is thread-safe.
What is URLRequest in Swift?
URLRequest represents an HTTP request. It contains method, headers, body, and cache policy. It can be configured before sending. Requests are immutable after creation. It defines how data is sent.
What is URLComponents in Swift?
URLComponents constructs URLs safely. It manages query parameters and encoding. It prevents malformed URLs. It is preferred over manual string concatenation. It improves correctness.
What are the different HTTP methods?
GET retrieves data. POST creates resources. PUT replaces resources. PATCH partially updates. DELETE removes resources. Each has semantic meaning.
What are HTTP response status codes?
They indicate request results. 2xx means success. 4xx indicates client errors. 5xx indicates server errors. Proper handling is essential for robust networking.
What is OAuth protocol?
OAuth is an authorization framework. It allows secure delegated access. Users authenticate without sharing credentials. Tokens represent access rights. OAuth is widely used in APIs.
What is caching in iOS apps?
Caching stores responses to reduce network usage. URLCache provides built-in support. Caching improves performance and battery life. Cache policies control behavior. Incorrect caching causes stale data issues.
What is Result type in Swift?
Result represents success or failure explicitly. It wraps a success value or an error. It enforces error handling. Result is heavily used in async APIs. It improves clarity.
How do you handle retry calls in API requests?
By retrying failed requests conditionally. Combine offers retry operators. Custom logic may use backoff strategies. Avoid infinite retries. Respect network conditions.
How do you check for internet availability in iOS?
Use NWPathMonitor. It reports network reachability. It replaces deprecated Reachability APIs. Monitoring must be retained. Availability can change dynamically.