Array list Rearrangement in swift


Hello guy, Today we will learn about Array list Rearrangement in swift.

Sometimes we need to change the position of the array like I want to change the array index 6 value to index 2 and remain list is the same as per their position. At that time we need to do array rearrangement. let’s start with an example.

Getting Started:-

Step1:- Firstly, Create an Xcode project

File –> New –> Project –> iOS –> Next and add your project name then create.

Step 2:- Secondly, Create a table view in the storyboard.

xcode stoaryboard image for Array list Rearrangement

Step 3:- Now, Create a swift class and add the code and run the code.

And the output is –

device output screen for Array list Rearrangement

Step 4:- Now, I want to change the position of the array list. In my example I want to change the number nine position at index 2, For this, I need to call a function.

Step 5:- Function calling to change the position. you just need to call

Step 6:- Lastly, Run the project and see the result!!!

In this screenshot, you will see that number nine is shifted to position 2, and the remaining array is the same.


In this blog, we have discussed Array list Rearrangement in swift.

I hope this blog will help you to understand the rearrangement process of the array.

To learn about more iOS-related topics, Please click here.

Thanks for reading!!!

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*

Be the first to comment.


All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.

Josh Arnold

Josh Arnold

Owner, Shop ATV Escape

Talk to Sales


Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home