From e4d90dd81ccd6f4a7e6b81158182cdb083f5f9cc Mon Sep 17 00:00:00 2001 From: BEOMSU Date: Sun, 8 Jun 2025 14:39:04 +0900 Subject: [PATCH 1/2] =?UTF-8?q?chore:=20SnapKit,=20Then=20=EC=84=A4?= =?UTF-8?q?=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - SnapKit: 오토레이아웃을 코드로 간결하게 작성하기 위해 - Then: 초기화 및 설정을 체이닝 스타일로 간결하게 작성하기 위해 --- .../MatzipBook.xcodeproj/project.pbxproj | 18 ++++++++++++++++++ MatzipBook/Podfile | 2 ++ MatzipBook/Podfile.lock | 10 +++++++++- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/MatzipBook/MatzipBook.xcodeproj/project.pbxproj b/MatzipBook/MatzipBook.xcodeproj/project.pbxproj index 8d0fb0c..2e82abd 100644 --- a/MatzipBook/MatzipBook.xcodeproj/project.pbxproj +++ b/MatzipBook/MatzipBook.xcodeproj/project.pbxproj @@ -100,6 +100,7 @@ 05E5F5B32D956A6A00F0CB97 /* Sources */, 05E5F5B42D956A6A00F0CB97 /* Frameworks */, 05E5F5B52D956A6A00F0CB97 /* Resources */, + 532A9B645B82AC22686798EF /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -178,6 +179,23 @@ shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/SwiftLint/swiftlint\"\n"; }; + 532A9B645B82AC22686798EF /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; B3FD7D6A459785F2C512B25D /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/MatzipBook/Podfile b/MatzipBook/Podfile index 308983e..6f4d191 100644 --- a/MatzipBook/Podfile +++ b/MatzipBook/Podfile @@ -5,6 +5,8 @@ target 'MatzipBook' do # Pods for MatzipBook pod 'SwiftLint' + pod 'SnapKit' + pod 'Then' post_install do |installer| installer.pods_project.targets.each do |target| diff --git a/MatzipBook/Podfile.lock b/MatzipBook/Podfile.lock index cb4c9f3..2e42e5d 100644 --- a/MatzipBook/Podfile.lock +++ b/MatzipBook/Podfile.lock @@ -1,16 +1,24 @@ PODS: + - SnapKit (5.7.1) - SwiftLint (0.59.1) + - Then (3.0.0) DEPENDENCIES: + - SnapKit - SwiftLint + - Then SPEC REPOS: trunk: + - SnapKit - SwiftLint + - Then SPEC CHECKSUMS: + SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a SwiftLint: 3d48e2fb2a3468fdaccf049e5e755df22fb40c2c + Then: 844265ae87834bbe1147d91d5d41a404da2ec27d -PODFILE CHECKSUM: 2654d5e3e6997c854ff1671419d73ca19518ac76 +PODFILE CHECKSUM: 5dc0ecf6f2fa41dbae9b05051d76c36bdab74fdd COCOAPODS: 1.16.2 From 80c77f8f275d17f30b05adc6b963ecbf0f58e3de Mon Sep 17 00:00:00 2001 From: BEOMSU Date: Sun, 8 Jun 2025 14:59:07 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20BaseViewController=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84=20=EB=B0=8F=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MatzipBook.xcodeproj/project.pbxproj | 4 ++ .../Bookmark/BookmarkViewController.swift | 9 +-- .../Common/Base/BaseViewController.swift | 64 +++++++++++++++++++ .../Home/HomeViewController.swift | 9 +-- .../Presentation/Map/MapViewController.swift | 9 +-- .../Profile/ProfileViewController.swift | 9 +-- 6 files changed, 72 insertions(+), 32 deletions(-) create mode 100644 MatzipBook/MatzipBook/Presentation/Common/Base/BaseViewController.swift diff --git a/MatzipBook/MatzipBook.xcodeproj/project.pbxproj b/MatzipBook/MatzipBook.xcodeproj/project.pbxproj index 2e82abd..ff264cd 100644 --- a/MatzipBook/MatzipBook.xcodeproj/project.pbxproj +++ b/MatzipBook/MatzipBook.xcodeproj/project.pbxproj @@ -187,10 +187,14 @@ inputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); + inputPaths = ( + ); name = "[CP] Embed Pods Frameworks"; outputFileListPaths = ( "${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); + outputPaths = ( + ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MatzipBook/Pods-MatzipBook-frameworks.sh\"\n"; diff --git a/MatzipBook/MatzipBook/Presentation/Bookmark/BookmarkViewController.swift b/MatzipBook/MatzipBook/Presentation/Bookmark/BookmarkViewController.swift index 91d3271..f539a66 100644 --- a/MatzipBook/MatzipBook/Presentation/Bookmark/BookmarkViewController.swift +++ b/MatzipBook/MatzipBook/Presentation/Bookmark/BookmarkViewController.swift @@ -7,11 +7,4 @@ import UIKit -class BookmarkViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = UIColor.mainBackgroundColor - } -} +final class BookmarkViewController: BaseViewController {} diff --git a/MatzipBook/MatzipBook/Presentation/Common/Base/BaseViewController.swift b/MatzipBook/MatzipBook/Presentation/Common/Base/BaseViewController.swift new file mode 100644 index 0000000..cf198f3 --- /dev/null +++ b/MatzipBook/MatzipBook/Presentation/Common/Base/BaseViewController.swift @@ -0,0 +1,64 @@ +// +// BaseViewController.swift +// MatzipBook +// +// Created by 심범수 on 6/8/25. +// + +import UIKit + +import SnapKit +import Then + +class BaseViewController: UIViewController { + + override func viewDidLoad() { + super.viewDidLoad() + + setupStyles() + setupLayouts() + setupConstraints() + } + + /// 뷰의 시각적 속성(스타일)을 설정합니다. + /// + /// 이 메서드는 `backgroundColor`, `font`, `textColor`, `cornerRadius` 등 + /// 레이아웃이나 계층 구조에 영향을 주지 않는 **시각적인 속성만을 설정**하는 데 사용됩니다. + /// + /// 예: + /// ```swift + /// titleLabel.textColor = .labelPrimary + /// titleLabel.font = .systemFont(ofSize: 16, weight: .bold) + /// layer.cornerRadius = 12 + /// ``` + func setupStyles() { + view.backgroundColor = .mainBackgroundColor + } + + /// 뷰의 계층 구조를 설정합니다. + /// + /// 이 메서드는 서브뷰를 상위 뷰에 추가하는 작업을 담당하며, + /// `addSubview`, `addArrangedSubview` 등을 통해 **뷰의 구조를 구성**합니다. + /// 일반적으로 제약 조건 설정 전에 호출됩니다. + /// + /// 예: + /// ```swift + /// view.addSubview(titleLabel) + /// stackView.addArrangedSubview(subtitleLabel) + /// ``` + func setupLayouts() {} + + /// 오토레이아웃 제약 조건을 설정합니다. + /// + /// 이 메서드는 뷰 간의 위치, 크기, 정렬 관계 등의 **제약 조건을 정의**합니다. + /// `setupLayouts()` 이후 호출되어야 하며, 레이아웃의 정확한 동작을 위해 필수입니다. + /// + /// 예: + /// ```swift + /// titleLabel.snp.makeConstraints { + /// $0.top.equalToSuperview().inset(16) + /// $0.leading.trailing.equalToSuperview().inset(20) + /// } + /// ``` + func setupConstraints() {} +} diff --git a/MatzipBook/MatzipBook/Presentation/Home/HomeViewController.swift b/MatzipBook/MatzipBook/Presentation/Home/HomeViewController.swift index be8ae2f..2c128b8 100644 --- a/MatzipBook/MatzipBook/Presentation/Home/HomeViewController.swift +++ b/MatzipBook/MatzipBook/Presentation/Home/HomeViewController.swift @@ -7,11 +7,4 @@ import UIKit -class HomeViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = UIColor.mainBackgroundColor - } -} +final class HomeViewController: BaseViewController {} diff --git a/MatzipBook/MatzipBook/Presentation/Map/MapViewController.swift b/MatzipBook/MatzipBook/Presentation/Map/MapViewController.swift index cee6862..3798a37 100644 --- a/MatzipBook/MatzipBook/Presentation/Map/MapViewController.swift +++ b/MatzipBook/MatzipBook/Presentation/Map/MapViewController.swift @@ -7,11 +7,4 @@ import UIKit -class MapViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = UIColor.mainBackgroundColor - } -} +final class MapViewController: BaseViewController {} diff --git a/MatzipBook/MatzipBook/Presentation/Profile/ProfileViewController.swift b/MatzipBook/MatzipBook/Presentation/Profile/ProfileViewController.swift index f597b02..cf7138f 100644 --- a/MatzipBook/MatzipBook/Presentation/Profile/ProfileViewController.swift +++ b/MatzipBook/MatzipBook/Presentation/Profile/ProfileViewController.swift @@ -7,11 +7,4 @@ import UIKit -class ProfileViewController: UIViewController { - - override func viewDidLoad() { - super.viewDidLoad() - - view.backgroundColor = UIColor.mainBackgroundColor - } -} +final class ProfileViewController: BaseViewController {}