Created
April 11, 2021 10:41
-
-
Save thatswiftguy/fa3324d593acccf9a85f24bd7a9df561 to your computer and use it in GitHub Desktop.
Task Model for TaskManager Application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// TaskModel.swift | |
// TaskManager | |
// | |
// Created by Mohammad Yasir on 11/04/21. | |
// | |
import Foundation | |
import SwiftUI | |
struct Task : Identifiable , Equatable { | |
var id : String = UUID().uuidString | |
let name : String | |
let taskName : String | |
let date : Date | |
let priority : Priority | |
} | |
enum Priority : Int , Identifiable , CaseIterable { | |
var id : Int { rawValue } | |
case normal | |
case medium | |
case high | |
var title : String { | |
switch self { | |
case .normal : | |
return "Normal" | |
case .medium : | |
return "Medium" | |
case .high : | |
return "High" | |
} | |
} | |
var color : Color { | |
switch self { | |
case .normal: | |
return .white | |
case .medium: | |
return .orange | |
case .high : | |
return .red | |
} | |
} | |
} | |
enum SortType : String , Identifiable , CaseIterable { | |
var id : String { rawValue } | |
case alphabetical | |
case date | |
case priority | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment