To iterate over characters in a string in Swift, you can use a for-in loop to iterate over the characters directly.
In this example,
str
with a value of "Swift"
.let str = "Swift"
for char in str {
print(char)
}
S w i f t
In this tutorial, we learned How to Iterate over Characters in String in Swift language with well detailed examples.