iOS ● ○ ○ Swift 6

Kodebits Day 54: String Replacement

Jul 8 2026
Practice strings with a short swift challenge.

What does this print?

let text = "Hello World"
let updated = text
  .replacing(
    "World",
    with: "Swift"
  )
print(updated)


Try it in the online Swift Playground →

[spoiler title="Solution"]

Answer:

Hello Swift

Explanation:

replacing returns a new string with substitutions applied.

[/spoiler]


Further Reading