Completion Not Called On Every Path (ARCH9020)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key swift.async.completion-not-called-on-every-path · Severity warning · Category async
Flags a completion-handler function with an early return that never calls the completion - the caller waits forever.
Incorrect
Section titled “Incorrect”func load(completion: @escaping (Result<User, Error>) -> Void) { guard let url = url else { return } ...}Correct
Section titled “Correct”guard let url = url else { completion(.failure(AppError.badUrl)); return }Call the completion on every exit path, or convert the function to async.