본문 바로가기
Mobile#Mobile#iOS#Concurrency조회 1

Swift async/await란?

정의

Swift 5.5+ 비동기 문법. 콜백·Combine을 명령형 흐름으로 대체.

Swift async/await

func fetch() async throws -> User {
  let (data, _) = try await URLSession.shared.data(from: url)
  return try JSONDecoder().decode(User.self, from: data)
}

actor

동시성 격리를 위한 새 타입. DispatchQueue 대신 권장.

🔗 함께 보면 좋은 용어

Mobile 전체 →