Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func getEquipmentHistory(for group: [String]) -> [Equipment] {
- if self.historyList.count > 0 {
- let historyList = self.historyList.filter({group.contains($0.equipment.group1)})
- let sorted = historyList.sorted(by: { (aData, bData) -> Bool in
- aData.dateAdded > bData.dateAdded
- })
- var list : [Equipment] = []
- for item in sorted {
- list.append(item.equipment)
- }
- let cut_down : ArraySlice<Equipment> = list.prefix(HISTORY_LIMIT)
- self.currentHistoryList = Array(cut_down)
- return self.currentHistoryList
- }
- return []
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement