New to Swift -- apologies. Suppose fetchString(@escaping completion: (String) -> Void)
.
How can I store the closure value response
in str
?
var str: String // suppose this is initialized
API.fetchString() { response in
str = response // or something similar like append
}
return str