Views: 10

Thank you for reading this post, don't forget to subscribe!

Sometimes, an app needs to shot the information inside an array.

Here’s a simple way to sort an array and print it to the console:

import UIKit
import Foundation

var names = [“Kelly”,”Michael”,”Danny”,”Sam”,”Ralph”,”Cathy”,”Thomas”,”Scott”] names.sort()
print (names)

  1. First, you put information inside the array.
  2. Then, you use the sort command.
  3. Finally, you print the results to the console, a UILabel, or an UITableView.

About Post Author

(Visited 15 times, 1 visits today)

Dan Uff
Senior Writer / Owner
https://www.compuscoop.com/