Filters.swift 981 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//
//  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

struct Filters {
	var showOpen = true
	var showClosed = true
	var sortBy = SortMethod.alphabetical
	var allAllFacilities = true
Zach Knox's avatar
Zach Knox committed
18
19
20
21
22
23
24
25
26
27
28
29
	var facilitiesShown: [Int: Bool] = [:]
	var facilities: [Facility]
	
	init(facilities: [Facility]) {
		self.facilities = facilities
		var count = 0
		for _ in facilities {
			facilitiesShown[count] = true
			count += 1
		}
	}
	
30
31
32
33
34
35
36
37
38
39
40
41
	
}

//Is this a viable way to do this?
enum SortMethod {
	case alphabetical //A -> Z
	case reverseAlphabetical //Z -> A
	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
	
	//We should figure out how we want to allow sorting
}