Skip to main content
InterviewHubPRO
Section Overview
Q31

Question 31 of 50

Part 3: Runtime Internals, Swift 6 Safety & Systems Programming (25 - 35)

62%
Swift & Concurrency (50 Qs)•Part 3: Runtime Internals, Swift 6 Safety & Systems Programming (25 - 35)

How does String manipulation work in Swift and why does String not support integer indexing?

senior LevelMost AskedDatabases & SQL

In Simple Words: Swift strings are collections of extended grapheme clusters (Unicode characters can consist of multiple code points, like flags and emojis with skin tones). Because characters vary in byte length, integer indexing cannot be $O(1)$ and is disallowed.