-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathPriority.swift
More file actions
34 lines (29 loc) · 867 Bytes
/
Priority.swift
File metadata and controls
34 lines (29 loc) · 867 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//
// Priority.swift
// To-Do
//
// Created by Amirthy Tejeshwar on 03/10/20.
// Copyright © 2020 Aaryan Kothari. All rights reserved.
//
import UIKit
enum Priority: String, CaseIterable {
case low = "LOW"
case medium = "MEDIUM"
case high = "HIGH"
func getPriorityIndex() -> Int {
return Priority.allCases.firstIndex(of: self)!
}
func getImageForPriority() -> UIImage? {
switch self {
case .low:
return UIImage(systemName: "exclamationmark")
case .medium:
return UIImage(systemName: "exclamationmark.square")
case .high:
return UIImage(systemName: "exclamationmark.square.fill")
}
}
static func getPriorityByIndex(index: Int) -> Priority {
return index < Priority.allCases.count ? Priority.allCases[index] : .low
}
}