Skip to content

Commit f34b2df

Browse files
authored
Merge pull request #19 from lsj8706/feat/#18-러닝시작전-카운트다운-뷰-UI
[Feat] #18 - CountDownVC 구현
2 parents f752460 + 0626805 commit f34b2df

File tree

4 files changed

+96
-2
lines changed

4 files changed

+96
-2
lines changed

Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
CE665612295D92E400C64E12 /* UserDefaultWrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE665611295D92E400C64E12 /* UserDefaultWrapper.swift */; };
6969
CE665615295D989A00C64E12 /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = CE665614295D989A00C64E12 /* .swiftlint.yml */; };
7070
CEB8416E2962C45300BF8080 /* LocationSearchResultTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */; };
71+
CEB841702963360800BF8080 /* CountDownVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEB8416F2963360800BF8080 /* CountDownVC.swift */; };
7172
CEC2A6852961F92C00160BF7 /* CustomButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A6842961F92C00160BF7 /* CustomButton.swift */; };
7273
CEC2A68729629B9B00160BF7 /* SignInVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A68629629B9B00160BF7 /* SignInVC.swift */; };
7374
CEC2A68A2962ADCD00160BF7 /* RNMapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC2A6892962ADCD00160BF7 /* RNMapView.swift */; };
@@ -153,6 +154,7 @@
153154
CE665611295D92E400C64E12 /* UserDefaultWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserDefaultWrapper.swift; sourceTree = "<group>"; };
154155
CE665614295D989A00C64E12 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
155156
CEB8416D2962C45300BF8080 /* LocationSearchResultTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationSearchResultTVC.swift; sourceTree = "<group>"; };
157+
CEB8416F2963360800BF8080 /* CountDownVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountDownVC.swift; sourceTree = "<group>"; };
156158
CEC2A6842961F92C00160BF7 /* CustomButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButton.swift; sourceTree = "<group>"; };
157159
CEC2A68629629B9B00160BF7 /* SignInVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignInVC.swift; sourceTree = "<group>"; };
158160
CEC2A6892962ADCD00160BF7 /* RNMapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNMapView.swift; sourceTree = "<group>"; };
@@ -292,6 +294,7 @@
292294
children = (
293295
CEEC6B392961C4F300D00E1E /* CourseDrawingHomeVC.swift */,
294296
CEC2A6912962BE2900160BF7 /* DepartureSearchVC.swift */,
297+
CEB8416F2963360800BF8080 /* CountDownVC.swift */,
295298
);
296299
path = VC;
297300
sourceTree = "<group>";
@@ -833,6 +836,7 @@
833836
CE6655D0295D85FF00C64E12 /* CancelBag.swift in Sources */,
834837
CE6655DC295D873500C64E12 /* UIButton+.swift in Sources */,
835838
CE6655D4295D865B00C64E12 /* Publisher+UIControl.swift in Sources */,
839+
CEB841702963360800BF8080 /* CountDownVC.swift in Sources */,
836840
CE6655EC295D88D000C64E12 /* UITableView+.swift in Sources */,
837841
CEEC6B3A2961C4F300D00E1E /* CourseDrawingHomeVC.swift in Sources */,
838842
CEC2A6902962B06C00160BF7 /* convertLocationObject.swift in Sources */,

Runnect-iOS/Runnect-iOS/Global/Literal/FontLiterals.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ extension UIFont {
3232
return UIFont.font(.pretendardSemiBold, ofSize: 15)
3333
}
3434

35+
@nonobjc class var h6: UIFont {
36+
return UIFont.font(.pretendardSemiBold, ofSize: 160)
37+
}
38+
3539
@nonobjc class var b1: UIFont {
3640
return UIFont.font(.pretendardMedium, ofSize: 17)
3741
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
//
2+
// CountDownVC.swift
3+
// Runnect-iOS
4+
//
5+
// Created by sejin on 2023/01/03.
6+
//
7+
8+
import UIKit
9+
10+
final class CountDownVC: UIViewController {
11+
12+
// MARK: - Properties
13+
14+
private var count = 3
15+
16+
// MARK: - UI Components
17+
18+
private let backgroundImageView = UIImageView().then {
19+
$0.image = ImageLiterals.imgBackground
20+
$0.contentMode = .scaleAspectFill
21+
}
22+
23+
private let timeLabel = UILabel().then {
24+
$0.text = "3"
25+
$0.font = .h6
26+
$0.textColor = .w1
27+
}
28+
29+
private let directionLabel = UILabel().then {
30+
$0.text = "잠시 후 러닝을 시작합니다"
31+
$0.font = .b1
32+
$0.textColor = .w1
33+
}
34+
35+
// MARK: - View Life Cycle
36+
37+
override func viewDidLoad() {
38+
super.viewDidLoad()
39+
setUI()
40+
setLayout()
41+
animateTimeLabel()
42+
}
43+
}
44+
45+
// MARK: - Methods
46+
47+
extension CountDownVC {
48+
private func animateTimeLabel() {
49+
self.timeLabel.transform = CGAffineTransform(scaleX: 0.4, y: 0.4)
50+
self.timeLabel.text = "\(self.count)"
51+
UIView.animate(withDuration: 1.0, animations: {
52+
self.timeLabel.transform = CGAffineTransform(scaleX: 1, y: 1)
53+
}, completion: { _ in
54+
self.count -= 1
55+
if self.count > 0 {
56+
self.animateTimeLabel()
57+
} else {
58+
print("Done")
59+
}
60+
})
61+
}
62+
}
63+
64+
// MARK: - UI & Layout
65+
66+
extension CountDownVC {
67+
private func setUI() {
68+
view.backgroundColor = .m1
69+
}
70+
71+
private func setLayout() {
72+
view.addSubviews(backgroundImageView, timeLabel, directionLabel)
73+
74+
backgroundImageView.snp.makeConstraints { make in
75+
make.edges.equalToSuperview()
76+
}
77+
78+
timeLabel.snp.makeConstraints { make in
79+
make.centerX.equalTo(view.safeAreaLayoutGuide)
80+
make.centerY.equalTo(view.safeAreaLayoutGuide).multipliedBy(0.9)
81+
}
82+
83+
directionLabel.snp.makeConstraints { make in
84+
make.centerX.equalTo(view.safeAreaLayoutGuide)
85+
make.centerY.equalTo(view.safeAreaLayoutGuide).multipliedBy(1.15)
86+
}
87+
}
88+
}

Runnect-iOS/Runnect-iOS/Presentation/CourseDrawing/VC/CourseDrawingHomeVC.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,3 @@ extension CourseDrawingHomeVC {
7171
}
7272
}
7373
}
74-
75-

0 commit comments

Comments
 (0)