My code adds a entry to the array but I don’t know how to sort in a alphabetical order. I just want to be able to sort whatever is in yourArray in alphabetical order.
import UIKit
var yourArray = [String]()
class ViewController: UIViewController {
@IBOutlet var textA: UITextField!
@IBAction func store(_ sender: Any) {
yourArray.append((textA.text!))
yourArray.sort()
print(yourArray)
}
}