Arrays and their methods in swift