I have a PFQueryTableViewController, and have create a separate TableViewController that allows me to select a filter option. When the user selects an option to filter by, I pass the index value back, and then append that Int value to an array. The variable is declared at the top like:var indexArray = [0]In my QueryForTable() function, I've written:    if indexArray == [0] {        query.orderByDescending(createdAt)    } else if indexArray == [1] {        query.orderByAscending(FilmName)    } else if indexArray == [2] {        query.orderByDescending(OurRating)    } else if indexArray == [3] {        query.orderByAscending(DirectedBy)    } else if indexArray == [4] {        query.orderByDescending(UpVoteCount)    } else if indexArray == [5] {        query.orderByDescending(DownVoteCount)    }This code works fine, and is filtering the option fine. I'm wondering if there is a better way to write the above code in my QueryForTable() function? Maybe to reduce the amount of code needed?Any advice appreciated. 
Filter option for PFQueryTableViewController in Swift
array;swift