تخطَّ إلى المحتوى

Expensive Object In Loop (ARCH9072)

هذا المحتوى غير متوفر بلغتك بعد.

Key swift.performance.expensive-object-in-loop · Severity warning · Category performance

Flags DateFormatter, NumberFormatter, JSONDecoder / JSONEncoder, ISO8601DateFormatter constructed inside a loop body.

for r in rows { let f = DateFormatter(); f.string(from: r.at) }
let f = DateFormatter()
for r in rows { f.string(from: r.at) }

Create the formatter / decoder once outside the loop and reuse it.