Skip to content

Instantly share code, notes, and snippets.

@thatswiftguy
Created April 11, 2021 10:41
Show Gist options
  • Save thatswiftguy/fa3324d593acccf9a85f24bd7a9df561 to your computer and use it in GitHub Desktop.
Save thatswiftguy/fa3324d593acccf9a85f24bd7a9df561 to your computer and use it in GitHub Desktop.
Task Model for TaskManager Application
//
// 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