Check out example codes for "Split a String into an array in Swift". It will help you in understanding the concepts better.

Code Example 1

let fullName = "First Last"    
let fullNameArr = fullName.components(separatedBy: " ")
let firstName = fullNameArr[0] //First
let lastName = fullNameArr[1] //Last

Learn ReactJs, React Native from akashmittal.com