Skip to content

Commit 4ff47b0

Browse files
committed
Update Realm version
1 parent 3a1f354 commit 4ff47b0

File tree

8 files changed

+80
-89
lines changed

8 files changed

+80
-89
lines changed

Podfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ target 'StopWatch' do
77

88
# Pods for StopWatch
99
pod 'RealmSwift', '~>10'
10+
pod 'Realm', '~>10'
1011

1112
end

Podfile.lock

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
PODS:
2-
- Realm (10.24.0):
3-
- Realm/Headers (= 10.24.0)
4-
- Realm/Headers (10.24.0)
5-
- RealmSwift (10.24.0):
6-
- Realm (= 10.24.0)
2+
- Realm (10.32.1):
3+
- Realm/Headers (= 10.32.1)
4+
- Realm/Headers (10.32.1)
5+
- RealmSwift (10.32.1):
6+
- Realm (= 10.32.1)
77

88
DEPENDENCIES:
9+
- Realm (~> 10)
910
- RealmSwift (~> 10)
1011

1112
SPEC REPOS:
@@ -14,9 +15,9 @@ SPEC REPOS:
1415
- RealmSwift
1516

1617
SPEC CHECKSUMS:
17-
Realm: 5d6f84e3f65d4efa204d46b461e5bbbbbbf84c6c
18-
RealmSwift: 9022754b93fad23e1ffc950c93574c5b7899bd51
18+
Realm: fd821b81e5479be497cc5bca2e020f707d8323eb
19+
RealmSwift: 8635e4cc524790916d72b0ffa51c1a91f4ec9668
1920

20-
PODFILE CHECKSUM: 354666582b899aa6e5db2bc7907c21b9383db509
21+
PODFILE CHECKSUM: 59caf2b07907bd3e0e7818f44c9ecedeaf4e7931
2122

2223
COCOAPODS: 1.11.3

StopWatch.xcodeproj/project.pbxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,15 @@
214214
isa = PBXGroup;
215215
children = (
216216
DB10DB8A27E4A040000560A3 /* Font */,
217-
DBA7ED5A27DDAFFF004B0D0E /* Models */,
218217
DB8F532D26F085D50071F911 /* Custom */,
219-
DB40D1F82609B32C00A4E9FC /* AppDelegate.swift */,
220-
DB289048261C4FF500FCC4BC /* Views */,
221218
DB0F172A261430F7007C8448 /* Utils */,
219+
DBA7ED5A27DDAFFF004B0D0E /* Models */,
220+
DB289048261C4FF500FCC4BC /* Views */,
222221
DB289046261C4F6600FCC4BC /* Controllers */,
223222
DB289047261C4F8000FCC4BC /* images */,
224223
DB40D1FE2609B32C00A4E9FC /* Main.storyboard */,
225224
DB40D2032609B32E00A4E9FC /* LaunchScreen.storyboard */,
225+
DB40D1F82609B32C00A4E9FC /* AppDelegate.swift */,
226226
DB40D2062609B32E00A4E9FC /* Info.plist */,
227227
);
228228
path = StopWatch;

StopWatch/Controllers/StopWatchViewController.swift

+42-37
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,32 @@ import UIKit
99
import CoreMotion
1010
import RealmSwift
1111

12+
1213
class StopWatchViewController: UIViewController {
1314
//MARK: - Properties
14-
let realm = try! Realm()
15-
var saveDate: String = "" {
16-
didSet{ // 날짜가 바뀔 때마다
17-
self.setGoalTime() // 목표시간 Label 재설정
18-
self.reloadProgressBar() // 진행바 재로딩
19-
self.setTimeLabel() // 현재시간 Label 재설정
20-
self.titleView.label.text = CalendarMethod().convertDate(date: self.saveDate) // 타이틀 날짜 다시표시
21-
self.toDoTableView.reloadData()
22-
self.calendarView.saveDate = self.saveDate
23-
self.calendarView.calendarView.reloadData()
24-
}
25-
}
26-
15+
//전체 시간, 전체 목표시간 저장 프로퍼티
2716
var totalTime: TimeInterval = 0
2817
var totalGoalTime: TimeInterval = 0
18+
19+
let realm = try! Realm()
2920
var motionManager: CMMotionManager?
21+
3022
var concentraionTimerVC: ConcentrationTimeViewController?
31-
var editListView: EditTodoListView?
23+
var editTodoListView: EditTodoListView?
3224
var editGoalTimeView: EditGoalTimeView?
3325
var chartView: ChartView?
3426
var guideLabelView: GuideLabelView?
35-
var tapGesture: UITapGestureRecognizer?
3627
var tapView: UIView?
28+
29+
var tapGesture: UITapGestureRecognizer?
30+
var timer: Timer?
31+
3732
var delegate: StopWatchVCDelegate?
3833
var saveDateDelegate: SaveDateDetectionDelegate?
39-
var timer: Timer?
34+
35+
var calendarViewHeight: NSLayoutConstraint!
36+
var frameViewHeight: NSLayoutConstraint!
37+
4038
// true : week, false : month
4139
var calendarMode = true {
4240
didSet {
@@ -48,8 +46,17 @@ class StopWatchViewController: UIViewController {
4846
}
4947
}
5048

51-
var calendarViewHeight: NSLayoutConstraint!
52-
var frameViewHeight: NSLayoutConstraint!
49+
var saveDate: String = "" {
50+
didSet{ // 날짜가 바뀔 때마다
51+
self.setGoalTime() // 목표시간 Label 재설정
52+
self.reloadProgressBar() // 진행바 재로딩
53+
self.setTimeLabel() // 현재시간 Label 재설정
54+
self.titleView.label.text = CalendarMethod().convertDate(date: self.saveDate) // 타이틀 날짜 다시표시
55+
self.toDoTableView.reloadData()
56+
self.calendarView.saveDate = self.saveDate
57+
self.calendarView.calendarView.reloadData()
58+
}
59+
}
5360

5461
let titleView: TitleView = {
5562
let view = TitleView()
@@ -285,7 +292,6 @@ class StopWatchViewController: UIViewController {
285292
if self.guideLabelView != nil{
286293
UIView.transition(with: self.guideLabelView!, duration: 3, options: [.repeat, .transitionFlipFromTop], animations: nil, completion: nil)
287294
}
288-
289295
}
290296

291297
func autoScrollCurrentDate(){
@@ -472,7 +478,7 @@ class StopWatchViewController: UIViewController {
472478
self.dDayLabel.text = "It's been \(abs(dday)) days."
473479
}
474480

475-
481+
476482
}
477483

478484
//MARK: Selector
@@ -498,24 +504,24 @@ class StopWatchViewController: UIViewController {
498504
self.saveDateDelegate?.detectSaveDate(date: self.saveDate)
499505
}
500506

507+
//주 <-> 월 달력 변경 버튼 클릭
501508
@objc func changeCalendarMode(_ sender: UIButton){
502509
UIView.animate(withDuration: 0.5){
503510
if self.calendarMode {
504511
self.calendarView.calendarMode = .month
505512
self.calendarViewHeight.isActive = false
506513
self.frameViewHeight.isActive = false
507-
508-
self.calendarViewHeight = self.calendarView.heightAnchor.constraint(equalToConstant: 220)
509514
self.frameViewHeight = self.frameView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.86)
515+
self.calendarViewHeight = self.calendarView.heightAnchor.constraint(equalToConstant: 220)
516+
510517
self.mainTimeLabel.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
511518
self.dDayLabel.alpha = 0
512519
self.changeCalendarMode.setTitle("월▾", for: .normal)
513-
520+
514521
self.calendarViewHeight.isActive = true
515522
self.frameViewHeight.isActive = true
516-
self.frameView.layoutIfNeeded()
517523
self.mainTimeLabel.layoutIfNeeded()
518-
524+
519525
self.chartView?.labelConstraint.isActive = false
520526
self.chartView?.labelConstraint.constant = 0
521527
self.chartView?.labelConstraint.isActive = true
@@ -524,25 +530,24 @@ class StopWatchViewController: UIViewController {
524530
self.calendarView.calendarMode = .week
525531
self.calendarViewHeight.isActive = false
526532
self.frameViewHeight.isActive = false
527-
533+
528534
self.calendarViewHeight = self.calendarView.heightAnchor.constraint(equalToConstant: 66)
529-
535+
530536
self.frameViewHeight = self.frameView.heightAnchor.constraint(equalTo: self.view.heightAnchor, multiplier: 0.76)
531537
self.mainTimeLabel.font = .systemFont(ofSize: 50, weight: .regular)
532538
self.mainTimeLabel.transform = CGAffineTransform(scaleX: 1, y: 1)
533539
self.dDayLabel.alpha = 1
534540
self.changeCalendarMode.setTitle("주▾", for: .normal)
535-
541+
536542
self.calendarViewHeight.isActive = true
537543
self.frameViewHeight.isActive = true
538-
self.frameView.layoutIfNeeded()
539544
self.mainTimeLabel.layoutIfNeeded()
540-
545+
541546
self.chartView?.labelConstraint.isActive = false
542547
self.chartView?.labelConstraint.constant = 30
543548
self.chartView?.labelConstraint.isActive = true
544549
self.chartView?.layoutIfNeeded()
545-
550+
546551
}
547552
self.chartView?.setNeedsDisplay() // 차트 뷰 다시그리기
548553
self.calendarMode = !self.calendarMode
@@ -905,7 +910,7 @@ extension StopWatchViewController {
905910
self.calendarViewHeight.isActive = true
906911

907912
NSLayoutConstraint.activate([
908-
self.toDoTableView.topAnchor.constraint(equalTo: self.calendarView.bottomAnchor, constant: 0),
913+
self.toDoTableView.topAnchor.constraint(equalTo: self.calendarView.bottomAnchor, constant: 10),
909914
self.toDoTableView.bottomAnchor.constraint(equalTo: self.goalTimeView.topAnchor),
910915
self.toDoTableView.leadingAnchor.constraint(equalTo: self.view.leadingAnchor, constant: 20),
911916
self.toDoTableView.trailingAnchor.constraint(equalTo: self.view.trailingAnchor, constant: -20),
@@ -1041,9 +1046,9 @@ extension StopWatchViewController: UITableViewDelegate,UITableViewDataSource{
10411046
}
10421047

10431048
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
1044-
guard self.editListView == nil else { return }
1049+
guard self.editTodoListView == nil else { return }
10451050

1046-
self.editListView = {
1051+
self.editTodoListView = {
10471052
let view = EditTodoListView()
10481053
self.setTapGesture() // 외부 탭 하면 닫히는 제스쳐 추가
10491054
self.view.addSubview(view)
@@ -1146,7 +1151,7 @@ extension StopWatchViewController: UITextFieldDelegate {
11461151
extension StopWatchViewController {
11471152

11481153
@objc func editListMethod(_ sender: UIButton){
1149-
if let editView = self.editListView {
1154+
if let editView = self.editTodoListView {
11501155
let indexPath = editView.indexPath
11511156
let (section,row) = (indexPath!.section,indexPath!.row)
11521157
guard let segment = self.realm.object(ofType: DailyData.self, forPrimaryKey: self.saveDate)?.dailySegment else { return }
@@ -1232,12 +1237,12 @@ extension StopWatchViewController {
12321237
}
12331238

12341239
func closeListEditView(){
1235-
if let editView = self.editListView {
1240+
if let editView = self.editTodoListView {
12361241
UIView.animate(withDuration: 0.3,animations: {
12371242
editView.center = CGPoint(x: self.view.frame.width / 2, y: self.view.frame.height + 40)
12381243
}){ (_) in
12391244
editView.removeFromSuperview() // 슈퍼뷰에서 제거!
1240-
self.editListView = nil
1245+
self.editTodoListView = nil
12411246
self.removeTapView()
12421247
}
12431248
}

StopWatch/Info.plist

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
<array>
3737
<string>armv7</string>
3838
</array>
39+
<key>UIStatusBarStyle</key>
40+
<string>UIStatusBarStyleDefault</string>
3941
<key>UISupportedInterfaceOrientations</key>
4042
<array>
4143
<string>UIInterfaceOrientationPortrait</string>

StopWatch/Utils/Utils.swift

+7
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,10 @@ extension UITextField {
9090
self.layer.masksToBounds = true
9191
}
9292
}
93+
94+
95+
extension NSLayoutConstraint {
96+
func constraintWithMultiplier(_ multiplier: CGFloat) -> NSLayoutConstraint {
97+
return NSLayoutConstraint(item: self.firstItem!, attribute: self.firstAttribute, relatedBy: self.relation, toItem: self.secondItem, attribute: self.secondAttribute, multiplier: multiplier, constant: self.constant)
98+
}
99+
}

0 commit comments

Comments
 (0)