-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDayObject.swift
58 lines (56 loc) · 1.95 KB
/
DayObject.swift
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//
// DayObject.swift
// Weekli
//
// Created by nyuguest on 12/6/17.
// Copyright © 2017 abrarandpaul. All rights reserved.
//
import UIKit
class DayObject: NSObject {
var todaysDate = Date()
var todaysMonth : Int = 0
var todaysDay : Int = 0
var todaysYear : Int = 0
var todaysEventsDateTimes : [DateComponents] = []
var todaysEventsDescriptions : [String] = []
var todaysEventsTimeElapsed : [Int] = []
var todaysEventIDs : [String] = []
private var numEvents = 0
func initWith(todaysEventDateTime:DateComponents, todaysEventsDescription: String, todaysEventsTimes: Int,
day: Int, month: Int, year: Int, hour: Int, minute: Int, eventID: String) {
todaysEventsDateTimes = [todaysEventDateTime]
todaysEventsDescriptions = [todaysEventsDescription]
todaysEventsTimeElapsed = [todaysEventsTimes]
if (todaysEventDateTime.date != nil) {
todaysDate = todaysEventDateTime.date!
}
todaysMonth = month
todaysYear = year
todaysDay = day
numEvents = 1
todaysEventIDs = [eventID]
}
func add(todaysEventDateTime: DateComponents, todaysEventsDescription: String, todaysEventsTimes: Int,
day: Int, month: Int, year: Int, hour: Int, minute: Int, eventID: String) {
todaysDay = day
todaysMonth = month
todaysYear = year
todaysEventsDateTimes.append(todaysEventDateTime)
todaysEventsDescriptions.append(todaysEventsDescription)
todaysEventsTimeElapsed.append(todaysEventsTimes)
numEvents = numEvents + 1
todaysEventIDs.append(eventID)
}
func getNumEvents() -> Int {
return numEvents
}
func getDateComponent(i:Int) -> DateComponents {
return todaysEventsDateTimes[i]
}
func getDescription(i:Int) -> String {
return todaysEventsDescriptions[i]
}
func getEventID(i:Int) -> String {
return todaysEventIDs[i]
}
}