If you have got a string which is separated using any delimiter like ‘,’ or space or ‘|’ or any other fixed delimiter, you can easily split it in swift by using the following function
components(separatedBy: )
Example below converts a greetings string into a swift greetings array using delimiter
let greetings = "Namaste,Hello,Hi,Good morning,:)" let arrayGreeteings = greetings.components(separatedBy: ",") print(arrayGreeteings)
Hope this helps!!!