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]