Mid-Level
November 18, 2026Spot the bug: iOS
One snippet. Find the bug, or prove there isn't one.
swift
1import Foundation
2
3struct User { let id: UUID }
4
5final class UserRepository {
6 func save(_ user: User) async throws { /* ... */ }
7}
8
9final class ProfileViewModel {
10 let repository: UserRepository
11
12 init(repository: UserRepository) {
13 self.repository = repository
14 }
15
16 func saveProfile(_ user: User) async {
17 do {
18 try await repository.save(user)
19 } catch {
20 print("Error: \(error)")
21 }
22 }
23}
24Click the lines that carry the problem.
Your verdict
One attempt per day. The answer shows up right after.
Keep your streak
Create an account to keep your streak and track your progress.