Concurrency & async/await
async/await, Task, actors, MainActor, structured concurrency, task groups, cancellation
1What is an async function in Swift?
What is an async function in Swift?
Respuesta
An async function is one that can suspend and resume without blocking the thread. It uses the async keyword to indicate it can await asynchronous operations with await. The Swift compiler automatically generates code to manage the suspension state, allowing other tasks to execute during waits.
2What is the role of the await keyword in Swift?
What is the role of the await keyword in Swift?
Respuesta
The await keyword marks a potential suspension point where a function can be suspended while waiting for an asynchronous operation result. It signals to the compiler and Swift runtime that the execution context may change at this point, allowing the system to execute other tasks during the wait. This is fundamental to Swift's cooperative concurrency model.
3What is a Task in Swift concurrency?
What is a Task in Swift concurrency?
Respuesta
A Task is a unit of asynchronous work that represents an independent executing operation. It encapsulates an asynchronous operation and manages its lifecycle, enabling async code to be launched from a synchronous context.
What is the difference between Task and Task.detached?
How to use async let for concurrency?
+23 preguntas de entrevista
Otros temas de entrevista iOS
Swift Basics
Swift Language Essentials
UIKit Fundamentals
UIViewController Lifecycle
UserDefaults & Keychain
Application Lifecycle
Auto Layout & Constraints
UITableView & UICollectionView
SwiftUI Basics
SwiftUI State Management
SwiftUI Navigation
Networking & URLSession
Codable & JSON Parsing
Core Data
Protocol Oriented Programming
MVVM Architecture
Push Notifications
Unit Testing & XCTest
UI Testing
Xcode & Build System
Swift Package Manager
Memory Management & ARC
Combine Framework
iOS Design Patterns
Performance Optimization
Security & Encryption
SwiftUI Advanced
iOS Application Architecture
Domina iOS para tu próxima entrevista
Accede a todas las preguntas, flashcards, tests técnicos, ejercicios de code review y simuladores de entrevista.
Empieza gratis