I am trying to create a String with an array of Strings, I would expect this to work:
let format = "%@ and %@!"
let str1 = "bla"
let str2 = "blob"
private func formatItNicely(format: String, substrings: [String]) -> String {
return String(format: format, arguments: substrings)
}
let result = formatItNicely(format, substrings: [str1, str2])
but I am getting fatal error: can't unsafeBitCast between types of different sizes.
I have seen this and this and this questions (and many more), but I still don't know how to accomplish what I am trying to do.
String...I get the same result%@in order, without usingString(format:). Otherwise you would have to get down and dirty with the C variadic stuff.