EduFlow
Swift Essentials for iOS

Checkpoint: Shipping a Real App

Five questions on this section. Answer all of them, then see your score and why each answer is right or wrong.

Question 1 of 5

Each fetch takes about a second. How do you make this take about one second in total?

Swift
func loadAll() async throws -> (Decimal, Decimal) {
    let eur = try await service.fetchRate(from: "USD", to: "EUR")
    let gbp = try await service.fetchRate(from: "USD", to: "GBP")
    return (eur, gbp)
}
Question 2 of 5

A nonisolated helper function assigns to model.state on a @MainActor model, and Swift 6 reports “main actor-isolated property ‘state’ can not be mutated from a nonisolated context”. What’s a correct fix?

Question 3 of 5

The rates API returns HTTP 404 with an HTML page for an unknown currency. Your code decodes data right after URLSession.shared.data(from:). What do users see?

Question 4 of 5

An edit screen binds fields straight to a SwiftData model with @Bindable var expense: Expense. Product wants a Cancel button that discards changes. What’s the cleanest design?

Question 5 of 5

Which test verifies that record throws BudgetError.overLimit(by: 7)?

5 questions unanswered