SwiftLogo

Advertisement

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

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

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)


Discover more from CompuScoop.com

Subscribe to get the latest posts sent to your email.

Catch up on what you’ve missed:

Verified by MonsterInsights