ระดับกลาง
18 พฤศจิกายน 2569

หาบั๊กให้เจอ: iOS

โค้ดหนึ่งชิ้น หาบั๊กให้เจอ หรือพิสูจน์ว่าไม่มีบั๊ก

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}
24

คลิกบรรทัดที่เป็นต้นเหตุของปัญหา

คำตัดสินของคุณ

วันละหนึ่งครั้ง คำตอบจะแสดงทันทีหลังจากนั้น

รักษาสถิติต่อเนื่องของคุณ

สร้างบัญชีเพื่อเก็บสถิติต่อเนื่องและติดตามความคืบหน้า

สร้างบัญชี