Aller au contenu

String Concat In Loop (ARCH9070)

Ce contenu n’est pas encore disponible dans votre langue.

Key swift.performance.string-concat-in-loop · Severity info · Category performance

Flags += string accumulation inside a loop.

var out = ""
for p in parts { out += p }
let out = parts.joined()

Use joined(), or reserveCapacity before appending.