Filters.swift 1.68 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
//
//  Filters.swift
//  WhatsOpen
//
//  Created by Zach Knox on 5/7/17.
//  Copyright © 2017 SRCT. All rights reserved.
//

import Foundation

//This may be a stupid way to handle filters, but it should work; at least for now

Zach Knox's avatar
Zach Knox committed
13
class Filters {
14
15
16
17
	var showOpen = true
	var showClosed = true
	var sortBy = SortMethod.alphabetical
	var allAllFacilities = true
Zach Knox's avatar
Zach Knox committed
18
    var openFirst = true
Zach Knox's avatar
Zach Knox committed
19
	
20
	init() {
Zach Knox's avatar
Zach Knox committed
21
        //nothing to do here
Zach Knox's avatar
Zach Knox committed
22
23
	}
	
Zach Knox's avatar
Zach Knox committed
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
    func applyFiltersOnFacilities(_ facilities: [Facility]) -> [Facility] {
        
        
        return []
    }
    
    // Takes in array of Facilities, separates them into those open and closed, returning a tuple of 2 arrays
    private func separateOpenAndClosed(_ facilities: [Facility]) -> (open: [Facility], closed: [Facility]) {
        
        return ([], [])
    }
    
    // Sorts items in the given Facility array by name alphabetically (reverse if told)
    private func sortAlphabetically(_ facilities: [Facility], reverse: Bool = false) -> [Facility] {
        
        return []
    }
    
    // Sorts Facilities by their given location's name, and within those sorts A->Z
    private func sortByLocation(_ facilities: [Facility]) -> [Facility] {
        
        return []
    }
    
    
    
    
51
52
53
54
55
56
}

//Is this a viable way to do this?
enum SortMethod {
	case alphabetical //A -> Z
	case reverseAlphabetical //Z -> A
Zach Knox's avatar
Zach Knox committed
57
58
59
	case byLocation // A -> Z Locations, w/ A -> Z Facilities inside
    //case openLongest //Places things open longest on top; if only showing closed, shows opening soonest
	//case openShortest //Places things closing soonest on top; if only showing closed, shows opening furthest from now
60
61
62
	
	//We should figure out how we want to allow sorting
}