Queue Created Per Call (ARCH9040)
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Key swift.async.queue-created-per-call · Severity warning · Category async
Flags DispatchQueue(label:) / OperationQueue() created inside a function body - a new queue (and thread) per call.
Incorrect
Section titled “Incorrect”func save() { DispatchQueue(label: "io").async { } }Correct
Section titled “Correct”private let io = DispatchQueue(label: "io")Create the queue once as a property and reuse it.