From 5d03d3c099325af9346391692c13b88c91401d2a Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Thu, 5 Jan 2023 15:47:49 +0900 Subject: [PATCH 01/14] =?UTF-8?q?[Feat]=20#41=20-=20CourseDetailVC=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 4 +++ .../CourseDetail/VC/CourseDetailVC.swift | 27 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index d51883ff..e8a5da3a 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -18,6 +18,7 @@ A3BC2F3D296468E500198261 /* UploadedCourseInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */; }; A3BC2F3F2964706100198261 /* UploadedCourseInfoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */; }; A3BC2F4129667A0D00198261 /* NicknameEditorVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F4029667A0D00198261 /* NicknameEditorVC.swift */; }; + A3BC2F432966A93100198261 /* CourseDetailVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F422966A93100198261 /* CourseDetailVC.swift */; }; CE0D9FD329648DA300CEB5CD /* CustomAlertVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */; }; CE146770296568DC00DCEA1B /* RunTrackingVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */; }; CE14677829658C7200DCEA1B /* Stopwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14677729658C7200DCEA1B /* Stopwatch.swift */; }; @@ -115,6 +116,7 @@ A3BC2F3C296468E500198261 /* UploadedCourseInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadedCourseInfoModel.swift; sourceTree = ""; }; A3BC2F3E2964706100198261 /* UploadedCourseInfoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadedCourseInfoCVC.swift; sourceTree = ""; }; A3BC2F4029667A0D00198261 /* NicknameEditorVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NicknameEditorVC.swift; sourceTree = ""; }; + A3BC2F422966A93100198261 /* CourseDetailVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CourseDetailVC.swift; sourceTree = ""; }; CE0D9FD229648DA300CEB5CD /* CustomAlertVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomAlertVC.swift; sourceTree = ""; }; CE14676F296568DC00DCEA1B /* RunTrackingVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunTrackingVC.swift; sourceTree = ""; }; CE14677729658C7200DCEA1B /* Stopwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stopwatch.swift; sourceTree = ""; }; @@ -448,6 +450,7 @@ isa = PBXGroup; children = ( CEEC6B462961C5BB00D00E1E /* .gitkeep */, + A3BC2F422966A93100198261 /* CourseDetailVC.swift */, ); path = VC; sourceTree = ""; @@ -943,6 +946,7 @@ CEEC6B492961C5E200D00E1E /* SplashVC.swift in Sources */, CE6655D0295D85FF00C64E12 /* CancelBag.swift in Sources */, DA20D83F296696A000F1581F /* MapModel.swift in Sources */, + A3BC2F432966A93100198261 /* CourseDetailVC.swift in Sources */, A3BC2F3D296468E500198261 /* UploadedCourseInfoModel.swift in Sources */, CE6655DC295D873500C64E12 /* UIButton+.swift in Sources */, CE6655D4295D865B00C64E12 /* Publisher+UIControl.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift new file mode 100644 index 00000000..37145ccd --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -0,0 +1,27 @@ +// +// CourseDetailVC.swift +// Runnect-iOS +// +// Created by 몽이 누나 on 2023/01/05. +// + +import UIKit + +final class CourseDetailVC: UIViewController { + + // MARK: - UI Components + + // MARK: - View Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + } +} + +extension CourseDetailVC { + + // MARK: - Layout Helpers + + + +} From 67a1a8ddf2dc6b842dc71a2efd7dedb0d83dbac1 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Thu, 5 Jan 2023 15:56:14 +0900 Subject: [PATCH 02/14] =?UTF-8?q?[Feat]=20#41=20-=20NavigationBar=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 37145ccd..397b4b68 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -6,22 +6,41 @@ // import UIKit +import SnapKit +import Then final class CourseDetailVC: UIViewController { // MARK: - UI Components + private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) // MARK: - View Life Cycle override func viewDidLoad() { super.viewDidLoad() + setNavigationBar() + setUI() + setLayout() } } extension CourseDetailVC { // MARK: - Layout Helpers + private func setNavigationBar() { + view.addSubview(navibar) + + navibar.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(48) + } + } + private func setUI() { + + } - + private func setLayout() { + + } } From 1ed523f072f26bc6f8cde69148f25dc47ab65a92 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:06:35 +0900 Subject: [PATCH 03/14] =?UTF-8?q?[Feat]=20#41=20-=20=EC=A0=84=EC=B2=B4?= =?UTF-8?q?=EC=A0=81=EC=9D=B8=20=ED=8B=80=20=EA=B5=AC=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Supports/SceneDelegate.swift | 2 +- .../CourseDetail/VC/CourseDetailVC.swift | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift index b1a5c3a4..c76995a9 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) - window.rootViewController = TabBarController() + window.rootViewController = CourseDetailVC() self.window = window window.makeKeyAndVisible() } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 397b4b68..10be1965 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -13,6 +13,10 @@ final class CourseDetailVC: UIViewController { // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) + private let middleScorollView = UIScrollView() + private let bottomView = UIView() + + private let likeButton = UIButton() // MARK: - View Life Cycle @@ -37,10 +41,23 @@ extension CourseDetailVC { } private func setUI() { - + view.backgroundColor = .w1 + bottomView.backgroundColor = .blue + middleScorollView.backgroundColor = .brown } private func setLayout() { + view.addSubviews(middleScorollView, bottomView) + bottomView.snp.makeConstraints { make in + make.bottom.leading.trailing.equalToSuperview() + make.height.equalTo(84) + } + + middleScorollView.snp.makeConstraints { make in + make.top.equalTo(navibar.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.bottom.equalToSuperview() + } } } From 772d2fd9abc840eb3c8980713adf248d1e4ded3a Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Thu, 5 Jan 2023 16:34:34 +0900 Subject: [PATCH 04/14] =?UTF-8?q?[Feat]=20#41=20-=20bottomView=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 10be1965..65b84210 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -16,7 +16,12 @@ final class CourseDetailVC: UIViewController { private let middleScorollView = UIScrollView() private let bottomView = UIView() - private let likeButton = UIButton() + private let likeButton = UIButton(type: .system).then { + $0.setImage(ImageLiterals.icHeart, for: .normal) + $0.tintColor = .g2 + } + + private let startButton = CustomButton(title: "시작하기") // MARK: - View Life Cycle @@ -54,6 +59,22 @@ extension CourseDetailVC { make.height.equalTo(84) } + bottomView.addSubviews(likeButton, startButton) + + likeButton.snp.makeConstraints { make in + make.top.equalToSuperview().offset(18) + make.leading.equalToSuperview().offset(26) + make.width.equalTo(24) + make.height.equalTo(22) + } + + startButton.snp.makeConstraints { make in + make.leading.equalTo(likeButton.snp.trailing).offset(20) + make.top.equalToSuperview().offset(10) + make.trailing.equalToSuperview().inset(16) + make.height.equalTo(40) + } + middleScorollView.snp.makeConstraints { make in make.top.equalTo(navibar.snp.bottom) make.leading.trailing.equalTo(view.safeAreaLayoutGuide) From fa0a1da5202a3a423151382fa8128db612cccd2b Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:33:55 +0900 Subject: [PATCH 05/14] =?UTF-8?q?[Feat]=20#41=20-=20TextField=20=EA=B8=80?= =?UTF-8?q?=EC=9E=90=20=EC=88=98=20=EC=A0=9C=ED=95=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 125 ++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 65b84210..b6e4a79b 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -11,10 +11,14 @@ import Then final class CourseDetailVC: UIViewController { + private var textFieldMaxLength: Int = 150 + // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) private let middleScorollView = UIScrollView() private let bottomView = UIView() + private let firstHorizontalDivideLine = UIView() + private let secondHorizontalDivideLine = UIView() private let likeButton = UIButton(type: .system).then { $0.setImage(ImageLiterals.icHeart, for: .normal) @@ -22,7 +26,55 @@ final class CourseDetailVC: UIViewController { } private let startButton = CustomButton(title: "시작하기") + + private let mapImage = UIImageView() + private let profileImage = UIImageView().then { + $0.image = ImageLiterals.imgStampC3 + $0.layer.cornerRadius = 20 + $0.layer.borderWidth = 1 + $0.layer.borderColor = UIColor.m3.cgColor + } + + private let profileNameLabel = UILabel().then { + $0.text = "말랑콩떡" + $0.textColor = .g1 + $0.font = .h5 + } + + private let runningLevelLabel = UILabel().then { + $0.text = "Lv. 3" + $0.textColor = .m1 + $0.font = .b5 + } + + private let courseTitleLabel = UILabel().then { + $0.text = "잠실 석촌호수 한 바퀴 러닝" + $0.textColor = .g1 + $0.font = .h4 + } + private let courseDistanceLabel = CourseDetailInfoView(title: "거리", description: "2.3km") + + private let courseDepartureLabel = CourseDetailInfoView(title: "출발지", description: "패스트파이브 을지로점") + + private lazy var courseDetailStackView = UIStackView(arrangedSubviews: [courseDistanceLabel, courseDepartureLabel]).then { + $0.axis = .vertical + $0.spacing = 6 + $0.distribution = .fillEqually + } + + private let courseExplanationLabel = UITextField().then { + $0.resignFirstResponder() + $0.text = nil + $0.textColor = .g1 + $0.font = .b3 + $0.attributedPlaceholder = NSAttributedString( + string: "내용을 입력하세요", + attributes: [NSAttributedString.Key.foregroundColor: UIColor.g2, NSAttributedString.Key.font: UIFont.b6] + ) + $0.keyboardType = .webSearch + } + // MARK: - View Life Cycle override func viewDidLoad() { @@ -49,6 +101,9 @@ extension CourseDetailVC { view.backgroundColor = .w1 bottomView.backgroundColor = .blue middleScorollView.backgroundColor = .brown + mapImage.backgroundColor = .g3 + firstHorizontalDivideLine.backgroundColor = .g3 + secondHorizontalDivideLine.backgroundColor = .g5 } private func setLayout() { @@ -75,10 +130,80 @@ extension CourseDetailVC { make.height.equalTo(40) } + setMiddleScrollView() + } + + private func setMiddleScrollView() { middleScorollView.snp.makeConstraints { make in make.top.equalTo(navibar.snp.bottom) make.leading.trailing.equalTo(view.safeAreaLayoutGuide) make.bottom.equalToSuperview() } + + middleScorollView.addSubviews(mapImage, profileImage, profileNameLabel, runningLevelLabel, firstHorizontalDivideLine, courseTitleLabel, courseDetailStackView, secondHorizontalDivideLine, courseExplanationLabel) + + mapImage.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(middleScorollView.snp.width).multipliedBy(0.7) + } + + profileImage.snp.makeConstraints { make in + make.top.equalTo(mapImage.snp.bottom).offset(14) + make.leading.equalToSuperview().offset(14) + make.width.height.equalTo(34) + } + + profileNameLabel.snp.makeConstraints { make in + make.centerY.equalTo(profileImage.snp.centerY) + make.leading.equalTo(profileImage.snp.trailing).offset(12) + } + + runningLevelLabel.snp.makeConstraints { make in + make.bottom.equalTo(profileNameLabel.snp.bottom) + make.trailing.equalTo(view.safeAreaLayoutGuide).inset(31) + } + + firstHorizontalDivideLine.snp.makeConstraints { make in + make.top.equalTo(mapImage.snp.bottom).offset(62) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(14) + make.height.equalTo(0.5) + } + + courseTitleLabel.snp.makeConstraints { make in + make.top.equalTo(firstHorizontalDivideLine.snp.bottom).offset(16) + make.leading.equalTo(view.safeAreaLayoutGuide).offset(16) + } + + courseDetailStackView.snp.makeConstraints { make in + make.top.equalTo(courseTitleLabel.snp.bottom).offset(19) + make.leading.trailing.equalToSuperview().inset(16) + } + + secondHorizontalDivideLine.snp.makeConstraints { make in + make.top.equalTo(courseDetailStackView.snp.bottom).offset(27) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(8) + } + + courseExplanationLabel.snp.makeConstraints { make in + make.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(3) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16) + make.height.equalTo(135) + } + } +} + +// MARK: - UITextFieldDelegate + +extension CourseDetailVC: UITextFieldDelegate { + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + guard let text = textField.text else {return false} + + // 최대 글자수 이상을 입력한 이후에는 중간에 다른 글자를 추가할 수 없게끔 작동 + if text.count >= textFieldMaxLength && range.length == 0 && range.location < textFieldMaxLength { + return false + } + + return true } } From e9082361898485817ebb7a12d3609856e335b68a Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:39:30 +0900 Subject: [PATCH 06/14] =?UTF-8?q?[Feat]=20#41=20-=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=20=EC=84=A4=EC=A0=95=20=EC=A4=91..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index b6e4a79b..cda6dcbc 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -85,6 +85,15 @@ final class CourseDetailVC: UIViewController { } } +// MARK: - Method + +extension CourseDetailVC { + func addKeyboardNotification() { + + } + +} + extension CourseDetailVC { // MARK: - Layout Helpers From 1da560d80ba701287ab89c9244954996ec9c1f4c Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:46:42 +0900 Subject: [PATCH 07/14] =?UTF-8?q?[Fix]=20#41=20-=20=ED=82=A4=EB=B3=B4?= =?UTF-8?q?=EB=93=9C=EA=B0=80=20=ED=95=84=EC=9A=94=20=EC=97=86=EC=9D=8C?= =?UTF-8?q?=EC=9D=84=20=EA=B9=A8=EB=8B=AC=EC=9D=8C..=E3=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 28 +------------------ 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index cda6dcbc..fc3d4307 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -63,16 +63,10 @@ final class CourseDetailVC: UIViewController { $0.distribution = .fillEqually } - private let courseExplanationLabel = UITextField().then { - $0.resignFirstResponder() + private let courseExplanationLabel = UITextView().then { $0.text = nil $0.textColor = .g1 $0.font = .b3 - $0.attributedPlaceholder = NSAttributedString( - string: "내용을 입력하세요", - attributes: [NSAttributedString.Key.foregroundColor: UIColor.g2, NSAttributedString.Key.font: UIFont.b6] - ) - $0.keyboardType = .webSearch } // MARK: - View Life Cycle @@ -87,12 +81,6 @@ final class CourseDetailVC: UIViewController { // MARK: - Method -extension CourseDetailVC { - func addKeyboardNotification() { - - } - -} extension CourseDetailVC { @@ -202,17 +190,3 @@ extension CourseDetailVC { } } -// MARK: - UITextFieldDelegate - -extension CourseDetailVC: UITextFieldDelegate { - func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { - guard let text = textField.text else {return false} - - // 최대 글자수 이상을 입력한 이후에는 중간에 다른 글자를 추가할 수 없게끔 작동 - if text.count >= textFieldMaxLength && range.length == 0 && range.location < textFieldMaxLength { - return false - } - - return true - } -} From b5a836e304bb130b99fc76ae6706c217fa856650 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 14:55:38 +0900 Subject: [PATCH 08/14] =?UTF-8?q?[Feat]=20#41=20-=20=EB=A0=88=EC=9D=B4?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EC=9E=A1=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index fc3d4307..5f81dd08 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -15,10 +15,14 @@ final class CourseDetailVC: UIViewController { // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) - private let middleScorollView = UIScrollView() + private lazy var middleScorollView = UIScrollView().then { + $0.isScrollEnabled = true + $0.showsVerticalScrollIndicator = false + } private let bottomView = UIView() private let firstHorizontalDivideLine = UIView() private let secondHorizontalDivideLine = UIView() + private let thirdHorizontalDivideLine = UIView() private let likeButton = UIButton(type: .system).then { $0.setImage(ImageLiterals.icHeart, for: .normal) @@ -63,10 +67,16 @@ final class CourseDetailVC: UIViewController { $0.distribution = .fillEqually } - private let courseExplanationLabel = UITextView().then { - $0.text = nil - $0.textColor = .g1 - $0.font = .b3 + private lazy var courseExplanationTextView = UITextView().then { + $0.text = "석촌 호수 한 바퀴 뛰는 코스에요! 평탄한 길과 느린 페이스, 난이도 하 코스입니다! 롯데월드 야경 감상 하면서 뛰기에 좋은 야간 코스에요! 석촌 호수 한 바퀴 뛰는 코스에요! 평탄한 길과 느린 페이스, 난이도 하 코스입니다! 롯데월드 야경 감상 하면서 뛰기에 좋은" + $0.isEditable = false + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.lineSpacing = 10 + let attributedString = NSMutableAttributedString(string: $0.text, attributes: [.font: UIFont.b3, .foregroundColor: UIColor.g1]) + attributedString.addAttribute(NSAttributedString.Key.paragraphStyle, value: paragraphStyle, range: NSRange(location: 0, length: attributedString.length)) + $0.attributedText = attributedString + $0.isScrollEnabled = false + $0.sizeToFit() } // MARK: - View Life Cycle @@ -79,9 +89,6 @@ final class CourseDetailVC: UIViewController { } } -// MARK: - Method - - extension CourseDetailVC { // MARK: - Layout Helpers @@ -96,21 +103,28 @@ extension CourseDetailVC { private func setUI() { view.backgroundColor = .w1 - bottomView.backgroundColor = .blue - middleScorollView.backgroundColor = .brown + bottomView.backgroundColor = .w1 + middleScorollView.backgroundColor = .w1 mapImage.backgroundColor = .g3 firstHorizontalDivideLine.backgroundColor = .g3 secondHorizontalDivideLine.backgroundColor = .g5 + thirdHorizontalDivideLine.backgroundColor = .g3 } private func setLayout() { - view.addSubviews(middleScorollView, bottomView) + view.addSubviews(middleScorollView, thirdHorizontalDivideLine, bottomView) bottomView.snp.makeConstraints { make in make.bottom.leading.trailing.equalToSuperview() make.height.equalTo(84) } + thirdHorizontalDivideLine.snp.makeConstraints { make in + make.bottom.equalTo(bottomView.snp.top) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(0.5) + } + bottomView.addSubviews(likeButton, startButton) likeButton.snp.makeConstraints { make in @@ -134,13 +148,14 @@ extension CourseDetailVC { middleScorollView.snp.makeConstraints { make in make.top.equalTo(navibar.snp.bottom) make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.bottom.equalToSuperview() + make.bottom.equalTo(thirdHorizontalDivideLine.snp.top) } - middleScorollView.addSubviews(mapImage, profileImage, profileNameLabel, runningLevelLabel, firstHorizontalDivideLine, courseTitleLabel, courseDetailStackView, secondHorizontalDivideLine, courseExplanationLabel) + middleScorollView.addSubviews(mapImage, profileImage, profileNameLabel, runningLevelLabel, firstHorizontalDivideLine, courseTitleLabel, courseDetailStackView, secondHorizontalDivideLine, courseExplanationTextView) mapImage.snp.makeConstraints { make in - make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.top.equalToSuperview() + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) make.height.equalTo(middleScorollView.snp.width).multipliedBy(0.7) } @@ -182,11 +197,10 @@ extension CourseDetailVC { make.height.equalTo(8) } - courseExplanationLabel.snp.makeConstraints { make in - make.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(3) + courseExplanationTextView.snp.makeConstraints { make in + make.top.equalTo(secondHorizontalDivideLine.snp.bottom).offset(17) make.leading.trailing.equalTo(view.safeAreaLayoutGuide).inset(16) - make.height.equalTo(135) + make.bottom.equalToSuperview().inset(20) } } } - From 98e5f7ba804462af38eb631ed05c7b6d7a778279 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:25:31 +0900 Subject: [PATCH 09/14] =?UTF-8?q?[Feat]=20#41=20-=20likeButton=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Supports/SceneDelegate.swift | 2 +- .../CourseDetail/VC/CourseDetailVC.swift | 22 +++++++++++++++++-- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift index c76995a9..e33f570a 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) - window.rootViewController = CourseDetailVC() + window.rootViewController = self.window = window window.makeKeyAndVisible() } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 5f81dd08..6ce21436 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -9,9 +9,15 @@ import UIKit import SnapKit import Then +protocol CourseDetailVCDelegate: AnyObject { + func likeButtonTapped(wantsTolike: Bool) +} + final class CourseDetailVC: UIViewController { - private var textFieldMaxLength: Int = 150 + // MARK: - Properties + + weak var delegate: CourseDetailVCDelegate? // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) @@ -24,9 +30,11 @@ final class CourseDetailVC: UIViewController { private let secondHorizontalDivideLine = UIView() private let thirdHorizontalDivideLine = UIView() - private let likeButton = UIButton(type: .system).then { + private lazy var likeButton = UIButton(type: .custom).then { $0.setImage(ImageLiterals.icHeart, for: .normal) + $0.setImage(ImageLiterals.icHeartFill, for: .selected) $0.tintColor = .g2 + $0.backgroundColor = .w1 } private let startButton = CustomButton(title: "시작하기") @@ -86,6 +94,16 @@ final class CourseDetailVC: UIViewController { setNavigationBar() setUI() setLayout() + likeButton.addTarget(self, action: #selector(likeButtonDidTap), for: .touchUpInside) + } +} + +// MARK: - @objc Function + +extension CourseDetailVC { + @objc func likeButtonDidTap(_ sender: UIButton) { + sender.isSelected.toggle() + delegate?.likeButtonTapped(wantsTolike: (sender.isSelected == true)) } } From 64222a70750b7a85895d251af2a8e89bf84860f9 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 15:44:31 +0900 Subject: [PATCH 10/14] =?UTF-8?q?[Feat]=20#41=20-=20CountDownVC=EC=99=80?= =?UTF-8?q?=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Supports/SceneDelegate.swift | 2 +- .../CourseDetail/VC/CourseDetailVC.swift | 14 +++++++++++++- .../CourseStorage/VC/CourseStorageVC.swift | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift index e33f570a..b1a5c3a4 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Supports/SceneDelegate.swift @@ -16,7 +16,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { guard let windowScene = (scene as? UIWindowScene) else { return } let window = UIWindow(windowScene: windowScene) - window.rootViewController = + window.rootViewController = TabBarController() self.window = window window.makeKeyAndVisible() } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 6ce21436..8fd92be4 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -37,7 +37,9 @@ final class CourseDetailVC: UIViewController { $0.backgroundColor = .w1 } - private let startButton = CustomButton(title: "시작하기") + private lazy var startButton = CustomButton(title: "시작하기").then { + $0.addTarget(self, action: #selector(pushToCountDownVC), for: .touchUpInside) + } private let mapImage = UIImageView() private let profileImage = UIImageView().then { @@ -107,6 +109,16 @@ extension CourseDetailVC { } } +// MARK: - Method + +extension CourseDetailVC { + @objc private func pushToCountDownVC() { + let countDownVC = CountDownVC() + countDownVC.setData(locations: [], distance: "1.0", pathImage: UIImage()) + self.navigationController?.pushViewController(countDownVC, animated: true) + } +} + extension CourseDetailVC { // MARK: - Layout Helpers diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift index 4664066d..cb33f09f 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseStorage/VC/CourseStorageVC.swift @@ -58,7 +58,9 @@ extension CourseStorageVC { scrapCourseListView.cellDidTapped.sink { [weak self] index in guard let self = self else { return } - print(index) + let courseDetailVC = CourseDetailVC() + courseDetailVC.hidesBottomBarWhenPushed = true + self.navigationController?.pushViewController(courseDetailVC, animated: true) }.store(in: cancelBag) } } From 204a352ca00cb68008fd8548e61a1a3140d52b51 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:04:41 +0900 Subject: [PATCH 11/14] =?UTF-8?q?[Fix]=20#41=20-=20UploadedCourseInfoVC=20?= =?UTF-8?q?=EC=BD=9C=EB=A0=89=EC=85=98=EB=B7=B0=20bottom=20=EA=B0=84?= =?UTF-8?q?=EA=B2=A9=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index 5e88188c..854aacf2 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -27,7 +27,7 @@ final class UploadedCourseInfoVC: UIViewController { // MARK: - Constants - final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 0, right: 16) + final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 25, right: 16) final let uploadedCourseLineSpacing: CGFloat = 20 final let uploadedCourseItemSpacing: CGFloat = 10 final let uplodaedCourseCellHeight: CGFloat = 124 @@ -84,7 +84,7 @@ extension UploadedCourseInfoVC { UploadedCourseInfoCollectionView.snp.makeConstraints { make in make.top.equalTo(navibar.snp.bottom) make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.bottom.equalToSuperview() + make.bottom.equalTo(view.safeAreaLayoutGuide) } } From b408650c48d8ade18c20ec5ba75a2ed9f7c60c58 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:08:04 +0900 Subject: [PATCH 12/14] =?UTF-8?q?[Fix]=20#41=20-=20delegate=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/CourseDetail/VC/CourseDetailVC.swift | 9 --------- .../MyPage/VC/InfoVC/UploadedCourseInfoVC.swift | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index 8fd92be4..aa94b0dd 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -9,16 +9,8 @@ import UIKit import SnapKit import Then -protocol CourseDetailVCDelegate: AnyObject { - func likeButtonTapped(wantsTolike: Bool) -} - final class CourseDetailVC: UIViewController { - // MARK: - Properties - - weak var delegate: CourseDetailVCDelegate? - // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton) private lazy var middleScorollView = UIScrollView().then { @@ -105,7 +97,6 @@ final class CourseDetailVC: UIViewController { extension CourseDetailVC { @objc func likeButtonDidTap(_ sender: UIButton) { sender.isSelected.toggle() - delegate?.likeButtonTapped(wantsTolike: (sender.isSelected == true)) } } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index 854aacf2..f71a4cf7 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -27,7 +27,7 @@ final class UploadedCourseInfoVC: UIViewController { // MARK: - Constants - final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 25, right: 16) + final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 25e, right: 16) final let uploadedCourseLineSpacing: CGFloat = 20 final let uploadedCourseItemSpacing: CGFloat = 10 final let uplodaedCourseCellHeight: CGFloat = 124 From fb9d62df4ed52275f20d3eaacc98bfe6f69dded4 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:10:34 +0900 Subject: [PATCH 13/14] =?UTF-8?q?[Fix]=20#41=20-=20=EC=98=A4=ED=83=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=E3=85=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift index f71a4cf7..854aacf2 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/UploadedCourseInfoVC.swift @@ -27,7 +27,7 @@ final class UploadedCourseInfoVC: UIViewController { // MARK: - Constants - final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 25e, right: 16) + final let uploadedCourseInset: UIEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 25, right: 16) final let uploadedCourseLineSpacing: CGFloat = 20 final let uploadedCourseItemSpacing: CGFloat = 10 final let uplodaedCourseCellHeight: CGFloat = 124 From 6414b8f14053a7e043a2c96995695e61fb79cf56 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:13:29 +0900 Subject: [PATCH 14/14] =?UTF-8?q?[Fix]=20#41=20-=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=9B=EC=9D=80=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDetail/VC/CourseDetailVC.swift | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift index aa94b0dd..e3e6c9ed 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDetail/VC/CourseDetailVC.swift @@ -88,7 +88,7 @@ final class CourseDetailVC: UIViewController { setNavigationBar() setUI() setLayout() - likeButton.addTarget(self, action: #selector(likeButtonDidTap), for: .touchUpInside) + setAddTarget() } } @@ -98,15 +98,19 @@ extension CourseDetailVC { @objc func likeButtonDidTap(_ sender: UIButton) { sender.isSelected.toggle() } + + @objc private func pushToCountDownVC() { + let countDownVC = CountDownVC() + countDownVC.setData(locations: [], distance: "1.0", pathImage: UIImage()) + self.navigationController?.pushViewController(countDownVC, animated: true) + } } // MARK: - Method extension CourseDetailVC { - @objc private func pushToCountDownVC() { - let countDownVC = CountDownVC() - countDownVC.setData(locations: [], distance: "1.0", pathImage: UIImage()) - self.navigationController?.pushViewController(countDownVC, animated: true) + private func setAddTarget() { + likeButton.addTarget(self, action: #selector(likeButtonDidTap), for: .touchUpInside) } }