-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Base 뷰 구현 (#14) #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
MatzipBook/MatzipBook/Presentation/Common/Base/BaseViewController.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| } | ||
|
Comment on lines
+34
to
+36
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion 설정 메서드들의 접근 제어자 개선 필요 하위 클래스에서 이 메서드들을 오버라이드할 수 있도록 - func setupStyles() {
+ open func setupStyles() {
view.backgroundColor = .mainBackgroundColor
}
- func setupLayouts() {}
+ open func setupLayouts() {}
- func setupConstraints() {}
+ open func setupConstraints() {}Also applies to: 49-49, 63-63 🤖 Prompt for AI Agents |
||
|
|
||
| /// 뷰의 계층 구조를 설정합니다. | ||
| /// | ||
| /// 이 메서드는 서브뷰를 상위 뷰에 추가하는 작업을 담당하며, | ||
| /// `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() {} | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
상속을 위한 접근 제어자 개선 필요
BaseViewController가 다른 모듈에서도 상속될 가능성을 고려하여
open class로 선언하는 것이 좋습니다.📝 Committable suggestion
🤖 Prompt for AI Agents