I was reading over some resources about Swift 5's String Interpolation and was trying it out in a Playground. I successfully combined two separate Strings but I am confused about how to combine an Array of Strings.
Here's what I did ...
String(stringInterpolation: {
let name = String()
var combo = String.StringInterpolation(literalCapacity: 7, interpolationCount: 1)
combo.appendLiteral("Sting One, ")
combo.appendInterpolation(name)
combo.appendLiteral("String Two")
print(combo)
return combo
}())
How would you do something like this with an Array of Strings?
String.StringInterpolationdirectly here?Stringsfrom the sameArray, so the output is one longString.jointhe array (calljoined) directly.String(describing:)to perform the conversion to a string representation. — However, I would urge you to add all this to the question; as I said, as it stands it is unclear what the point is, and the title “with an array of strings” would seem to be outright wrong. It might even be good just to show the actual JSON. There may be a much simpler way; this could well be an x-y question.