// In-place: array.sort { $0.selected && !$1.selected } // To a new array: array.sorted { $0.selected && !$1.selected }