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
  • 307,833
  • 40
  • 508
  • 550
PretzelJesus
  • 859
  • 3
  • 11
  • 20

0 Answers0