In Swift, you can create an empty string by initializing a variable with an empty string literal.
In this example,
emptyString
and initialize it with an empty string literal ""
.emptyString
now holds an empty string.var emptyString = ""
print("Empty string created: '\(emptyString)'")
Empty string created: ''
In this tutorial, we learned How to Create an Empty String in Swift language with well detailed examples.