Skip to content

Commit 6ba8301

Browse files
authored
Merge branch 'dev' into feature_SWColorPicker
2 parents ed00454 + a7991a3 commit 6ba8301

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

Podfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ target 'StopWatch' do
66
use_frameworks!
77

88
# Pods for StopWatch
9-
pod 'RealmSwift', '~>10'
10-
pod 'Realm', '~>10'
9+
pod 'RealmSwift'
10+
pod 'Realm'
1111
pod 'SnapKit', '~> 5.0.0'
1212
pod 'Then'
1313
pod 'SWColorPicker'

Podfile.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ PODS:
99
- Then (3.0.0)
1010

1111
DEPENDENCIES:
12-
- Realm (~> 10)
13-
- RealmSwift (~> 10)
12+
- Realm
13+
- RealmSwift
1414
- SnapKit (~> 5.0.0)
1515
- SWColorPicker
1616
- Then

StopWatch/Controllers/CategoryViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class CategoryViewController: UIViewController {
4545

4646
override func viewWillAppear(_ animated: Bool) {
4747
self.saveDate = (UIApplication.shared.delegate as! AppDelegate).resetDate
48-
StopWatchDAO().create(date: self.saveDate)
48+
// StopWatchDAO().create(date: self.saveDate)
4949

5050
self.categoryTableView.reloadData()
5151
self.configureNavigationBar()

StopWatch/Controllers/StopWatchViewController.swift

+8-6
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,19 @@ final class StopWatchViewController: UIViewController {
8989

9090
// gesture
9191
self.hideKeyboardWhenTapped()
92-
93-
// print("path = \(Realm.Configuration.defaultConfiguration.fileURL!)")
92+
93+
94+
// print("path = \(Realm.Configuration.defaultConfiguration.fileURL!)")
9495
}
9596

9697
override func viewWillAppear(_ animated: Bool) {
9798
super.viewWillAppear(animated)
9899
// 프로퍼티 값 갱신
99-
100100
self.setDeviceMotion() // coremotion 시작
101101
self.reloadProgressBar() // 진행바 재로딩
102102
self.setNavigationBar() // 네비게이션바 설정
103+
self.toDoTableView.reloadData()
104+
self.calendarView.calendarView.reloadData()
103105
self.setDday()
104106
self.setTimeLabel()
105107
self.guideLabelView.isHidden = false
@@ -781,11 +783,11 @@ extension StopWatchViewController {
781783
case 1:
782784
self.defaultAlert(title: nil, message: "정말 삭제 하시겠습니까?") {
783785
StopWatchDAO().deleteTodoList(segData, row: editView.row)
786+
StopWatchDAO().deleteDailyData(date: self.calendarView.selectDateComponent.stringFormat) // 데이터베이스에서 삭제
787+
self.calendarView.calendarView.reloadData()
788+
self.toDoTableView.reloadData()
784789
}
785790

786-
StopWatchDAO().deleteDailyData(date: self.calendarView.selectDateComponent.stringFormat) // 데이터베이스에서 삭제
787-
self.toDoTableView.reloadData()
788-
self.calendarView.calendarView.reloadData()
789791
self.closeListEditView()
790792
case 2:
791793
StopWatchDAO().changeListCheckImage(segData, row: editView.row)

StopWatch/Custom/StopWatchDAO.swift

+11-12
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class StopWatchDAO {
3232

3333
day.dailySegment.append(object) // 오늘 데이터에 오늘 과목들 넣기
3434
}
35-
35+
print(day)
3636
realm.add(day)
3737
}
3838
}
@@ -48,17 +48,16 @@ class StopWatchDAO {
4848

4949
realm.add(segment)
5050

51-
let segmentData = SegmentData() // 오늘의 과목에 추가
52-
segmentData.date = date
53-
segmentData.goal = 0
54-
segmentData.value = 0
55-
segmentData.segment = segment
56-
57-
realm.add(segmentData)
58-
59-
let dailyData = realm.object(ofType: DailyData.self, forPrimaryKey: date) // 오늘 데이터 불러오기
60-
61-
dailyData?.dailySegment.append(segmentData) // 오늘 데이터에 추가한 과목 추가
51+
if let dailyData = realm.object(ofType: DailyData.self, forPrimaryKey: date) {// 오늘 데이터 불러오기
52+
let segmentData = SegmentData() // 오늘의 과목에 추가
53+
segmentData.date = date
54+
segmentData.goal = 0
55+
segmentData.value = 0
56+
segmentData.segment = segment
57+
58+
realm.add(segmentData)
59+
dailyData.dailySegment.append(segmentData) // 오늘 데이터에 추가한 과목 추가
60+
}
6261
}
6362
}
6463

StopWatch/Views/CalendarView/CalendarView.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ final class CalendarView: UIView,UICollectionViewDelegate, UICollectionViewDataS
127127
let daysOfMonth = calendarMethod.getLastDayOfMonth(self.currentCalendarComponent)
128128
let weekDayAdding = 2 - weekDay
129129
self.yearMonthLabel.text = calendarMethod.convertYearMonth(self.currentCalendarComponent)
130-
130+
131131
self.days = []
132132
for day in weekDayAdding...daysOfMonth {
133133
if day < 1 {
@@ -144,6 +144,7 @@ final class CalendarView: UIView,UICollectionViewDelegate, UICollectionViewDataS
144144
var tempComponent = self.currentCalendarComponent
145145
tempComponent.day = day
146146
let dateString = dateFormatter.string(from: calendar.date(from: tempComponent)!)
147+
StopWatchDAO().deleteDailyData(date: currentCalendarComponent.stringFormat)
147148
if realm.object(ofType: DailyData.self, forPrimaryKey: dateString) == nil {
148149
return false
149150
} else {
@@ -238,6 +239,7 @@ final class CalendarView: UIView,UICollectionViewDelegate, UICollectionViewDataS
238239
cell.dateLabel.text = self.dayArray[indexPath.row]
239240
} else {
240241
cell.configureCell()
242+
241243
cell.dataCheckView.isHidden = !isData(days[indexPath.row])
242244
cell.dateLabel.text = days[indexPath.row]
243245
if let day = Int(days[indexPath.row]) {

0 commit comments

Comments
 (0)