From a php i am requesting a responce. The response should be an array [String]
however, swift is seeing this response as a String
.
How can I convert a String
to [String]
?
PHP:
print_r(json_encode($arrayUser));
// Print Out ["aaa","bbb","ccc","ddd"]
SWIFT 2.0:
let infoArray = responseValue
// Reads ["aaa","bbb","ccc","ddd"]
print(infoArray[1])
// error: Ambiguous use of 'subscript'
Why is Swift seeing the array as a string? And how can I convert it to an array [String]
?
I have also tried:
let infoArray = responseValue as! [String]
//warning: Cast from 'String' to unrelated type '[String]' always fails