Combine vs async/await

Combine Mid-level Swift 5.5+ iOS 15+ Reviewed By Alok Singh

Pick the fix

Which is the best fit for 'load the profile once when the screen appears'?

Options
Hint 1 of 1

How many values does this produce?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A An async function called from .task

Correct. It's one-shot, readable and cancelled automatically.

Why not the others?
  • B A Combine pipeline with Future and sink. It works, but adds ceremony and cancellable management.
  • C A PassthroughSubject the view subscribes to. Subjects are for streams, not one result.
  • D NotificationCenter. It's global and untyped.

30-second answer

Use async/await for one-shot work like requests and file I/O, and AsyncSequence for simple streams. Choose Combine when you need rich operators over several streams over time, such as combineLatest, debounce or switchToLatest, or when you're working with existing Combine code. With Observation, SwiftUI no longer needs @Published, so new code uses Combine less.

Practise saying it · 45 s. No recording, just a timer

Explain when you use Combine vs async/await.

Say your answer out loud, then check which of these points you covered:

  • One-shot: async/await
  • Multi-stream operators: Combine
  • Bridges both ways

Deep dive

Swift Async Algorithms adds debounce, merge and combineLatest for AsyncSequence.

publisher.values and AsyncStream bridge both ways.

Structured concurrency gives cancellation without cancellables.

Mixed codebases are normal; draw the boundary at the service layer.

Common mistakes

  • Rewriting working Combine pipelines for fashion.
  • Using Combine for one request.

Senior take & follow-ups

Seniors choose per problem and plan migrations at boundaries.

Follow-up questions

Think of your answer first, then open the hint.

  1. How do you bridge a callback API to async?

    Show hint

    withCheckedThrowingContinuation.

  2. Is Combine needed with @Observable?

    Show hint

    Not for SwiftUI updates.

Suggest a fix if something here is wrong or out of date.