1

I need to sort an array of custom classes by a class variable. This used to be easy for me in Objective C using sort descriptors, but for some reason I cannot get that to work in Swift. I have a class like this:

class Show : NSObject
{
    init()
    {
        super.init()
    }

    var firstName: String!
    var lastName: String!
}

I am creating my array like this:

var peopleArray = Show[]()

How do I sort the array by last names?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
PretzelJesus
  • 869
  • 3
  • 11
  • 21

0 Answers0