Skip to content
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

Feat [#14] 홈 뷰 UI 구현 #25

Merged
merged 11 commits into from
Jan 10, 2024
Merged

Feat [#14] 홈 뷰 UI 구현 #25

merged 11 commits into from
Jan 10, 2024

Conversation

yeonsu0-0
Copy link
Collaborator

👻 PULL REQUEST

💻 작업한 내용

  • 홈 뷰 UI 작업 완료했습니다.

💡 참고사항

  • 텍스트 길이에 따른 dynamic height 구현 예정입니다!

📸 스크린샷

기능 스크린샷
GIF

📟 관련 이슈

3CE9C12A2B4BE6780086E4A3 /* WriteViewController.swift in Sources */,
3C2854FD2B3A9FD800369C99 /* ExampleViewController.swift in Sources */,
2AAEFC992B4A9E3B00C2D323 /* DontBeTabBarController.swift in Sources */,
2AAEFC972B4A9C3700C2D323 /* DontBeTabBarItem.swift in Sources */,
3C2854F92B3A9E8A00369C99 /* ViewModel.swift in Sources */,
3C0920DE2B4D98CD003BD080 /* DontBeToastView.swift in Sources */,
3CE9C1302B4C2F740086E4A3 /* UIImageView+.swift in Sources */,
2A51AE852B4B05AA00FF770A /* SplashViewController.swift in Sources */,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize, but I am an AI language model and I don't have real-time data or the ability to browse the internet. My training only goes up until September 2021. Is there anything else I can help you with based on my existing knowledge?

Copy link
Collaborator

@Heyjooo Heyjooo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
수고하셨습니다 ~~~ !!!!!

Comment on lines 41 to 47
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()

let safeAreaHeight = view.safeAreaInsets.bottom
let tabBarHeight: CGFloat = 70.0.adjusted
collectionViewBottomHeight = Int(tabBarHeight + safeAreaHeight)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3
이부분 아래와 같이 구할 수 있습니다 ..!

tabBarController?.tabBar.frame.size.height ?? 0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

작동 잘 되네요! 다음과 같이 수정했습니다.

// MARK: - Properties
var tabBarHeight: CGFloat = 0

// ...

override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        
        tabBarHeight = tabBarController?.tabBar.frame.size.height ?? 0
}

// MARK: - UI Components
lazy var collectionView: UICollectionView = {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.minimumLineSpacing = 10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2
여기 adjusted 적용부탁드려요!

Copy link
Member

@boogios boogios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
홈 화면 UI 너무 이쁘게 잘 구현하셨네요!!!!! 고생하셨습니다~~!

// MARK: - Properties

// MARK: - UI Components
private let backgroundUIView: UIView = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
MARK 아래에 공백 하나 추가해주시면 좋을거 같아요!


private let nicknameLabel: UILabel = {
let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1
Snapkit 사용하면 translatesAutoresizingMaskIntoConstraints = false 처리해줄 필요가 없어서 모두 삭제해주시길 바랍니다!


private lazy var likeStackView: UIStackView = {
let stackView = UIStackView()
stackView.addArrangedSubviews(likeButton, likeNumLabel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1
addArrangedSubviews 는 setHierarchy() 함수안에 작성해주시면 감사하겠습니다!!~


func setHierarchy() {
contentView.addSubviews(backgroundUIView)
backgroundUIView.addSubviews(profileImageView, nicknameLabel, transparentLabel, dotLabel, timeLabel, kebabButton, contentTextLabel, commentStackView, likeStackView, ghostButton, verticalTextBarView)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
addSubviews 가 많을 경우에 엔터 한번씩 쳐주시면 계층이 더 잘 보일거같아여!!!!

func setLayout() {
backgroundUIView.snp.makeConstraints {
$0.edges.equalToSuperview()
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
요소들간의 공백 하나씩 있으면 좋을거같습니당!

//

import UIKit
import SnapKit
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
공백 하나만 추가해주시면 좋을거같습니다! 설치한 패키지 라이브러리는 보통 기존 프레임워크와 비교를 위해 한칸을 띄워놓더라구요!!

final class HomeViewController: UIViewController {

// MARK: - Properties
var collectionViewBottomHeight: Int = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
여기도 공백 하나 부탁드립니다~!!


extension HomeViewController: UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 10
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
여기도 혹시 adjusted 붙여줘야할까요..?!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cell 갯수는 딱히 기기 대응이 필요 없어서 괜찮을 것 같습니다 :>

final class HomeCollectionFooterView: UICollectionReusableView {

// MARK: - Properties
static let identifier = "HomeCollectionFooterView"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3
요기도 부탁드립니당!

image.contentMode = .scaleAspectFill
image.clipsToBounds = true
image.layer.borderWidth = 1.adjusted
image.layer.borderColor = UIColor.clear.cgColor
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1
border 관련 코드 없어도 괜찮을거같아요!!

$0.centerX.equalTo(profileImageView)
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치는 HomeCollectionViewCell이라는 콜렉션 뷰 셀을 정의하는 코드입니다. 몇 가지 특징과 개선 사항을 확인할 수 있습니다:

  1. HomeCollectionViewCell 클래스가 UICollectionViewRegisterable 프로토콜을 채택하고 있습니다.
  2. UI Components 섹션에서 셀의 UI 컴포넌트들이 선언되어 있습니다.
  3. UI 컴포넌트의 초기화와 스타일링은 클로저 내에서 이루어지고 있습니다. 이 부분에 대한 추가 주석이 필요합니다.
  4. setUI, setHierarchy, setLayout이라는 몇 가지 메서드가 구현되어 있습니다. 이 메서드들은 UI 컴포넌트를 초기화하고 계층 구조를 설정하며 레이아웃을 지정하는 역할을 합니다.
  5. SnapKit 라이브러리가 사용되어 UI 컴포넌트들의 제약 조건을 설정하고 있습니다.

개선 사항:

  1. 현재 코드에는 버그 위험이나 큰 문제는 보이지 않습니다. 그러나 해당 코드를 어떻게 사용하는지에 따라서 추가적인 검증이 필요할 수 있습니다.
  2. 클로저 내에서 UI 컴포넌트를 초기화하고 설정하는 부분을 주석으로 자세히 설명하면 코드의 의도를 더 명확히 전달할 수 있습니다.
  3. setUI, setHierarchy, setLayout 메서드들은 private 접근 제어자를 사용하여 클래스 내부에서만 사용되므로, private 키워드를 명시적으로 추가하면 좋습니다.
  4. SnapKit 라이브러리에 대한 의존성이 있으므로 해당 라이브러리가 프로젝트에 포함되어 있는지 확인해야 합니다.

이 코드 패치는 작업 중인 기능에 따라 약간의 수정이 필요하지만, 초기 검토 결과 이해하기 쉽고 잘 구조화된 코드입니다.

@yeonsu0-0 yeonsu0-0 merged commit b3f6339 into develop Jan 10, 2024
1 check passed
@yeonsu0-0 yeonsu0-0 deleted the feat/#14-homeUI branch January 10, 2024 05:03
return CGSize(width: UIScreen.main.bounds.width, height: 24.adjusted)

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

해당 코드는 "HomeViewController.swift" 파일의 코드이며, Don'tBe-iOS 앱에서 홈 화면을 담당하는 ViewController입니다.

주요 내용과 개선 사항은 다음과 같습니다:

  1. HomeViewController 클래스에 tabBarHeight라는 변수가 선언되어 있지만, 초기화되지 않았습니다.

    • 이 변수를 옵셔널 타입으로 선언하고, viewDidLayoutSubviews() 메소드에서 해당 값이 nil일 경우에 대한 예외 처리를 추가해야 합니다.
  2. setUI(), setHierarchy(), setLayout(), setDelegate()와 같은 메소드 이름은 무엇을 수행하는지 설명하기 어려울 수 있습니다.

    • 이러한 메소드 이름을 좀 더 명확하게 변경하는 것이 좋습니다. 예를 들어, configureUI(), setupViewHierarchy(), setLayoutConstraints(), setCollectionViewDelegate() 등의 이름으로 변경할 수 있습니다.
  3. UICollectionViewDelegateFlowLayout 프로토콜을 구현한 메소드인 collectionView(_:layout:sizeForItemAt:)collectionView(_:layout:referenceSizeForFooterInSection:)에서 사이즈 값을 고정적으로 반환하고 있습니다.

    • 이 메소드들은 동적인 값이 사용될 수 있도록 수정하는 것이 좋습니다. 예를 들어, 적절한 계산식을 사용하여 알맞은 크기를 반환하도록 변경할 수 있습니다.
  4. getAPI()라는 빈 메소드가 정의되어 있습니다.

    • 이 메소드를 실제 API 호출 로직으로 구현해야 합니다.
  5. 코드에 주석이 거의 없기 때문에 다른 개발자가 코드를 이해하기 어렵게 될 수 있습니다.

    • 주석을 추가하여 각 부분의 역할과 목적을 설명하는 것이 좋습니다.
  6. 코드 스타일은 일관적이고 읽기 쉽습니다. 하지만, 기능을 확장하고 고도화할 가능성을 고려해 몇 가지 유지 및 확장성 측면에서의 향상을 고려할 수 있습니다.

    • 예를 들어, 코드 모듈을 더 작은 기능 단위로 분리하고, 함께 사용될 수 있는 여러 부분을 그룹화하는 방법을 고려해볼 수 있습니다.

주의해야 할 버그나 수정사항은 없지만, 위의 개선 사항을 고려하여 코드를 유연하고 읽기 쉽도록 개선해보시기 바랍니다.

func setDataBind() {

}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 코드 패치는 iOS 앱의 Home 화면을 나타내는 HomeView 클래스입니다. 몇 가지 개선점과 버그 위험성을 지적해 드리겠습니다:

  1. logoImageView의 이미지를 설정하는 부분에서 ImageLiterals.Common.logoSymbol 대신 실제 이미지 파일 또는 리소스 이름을 사용하는 것이 좋습니다.

  2. setUI() 메서드가 구현되어 있지 않습니다. 이 메서드를 사용하여 UI 초기화 로직을 추가하는 것이 좋습니다.

  3. setAddTarget() 메서드와 buttonTapped() 메서드가 비어 있습니다. 이러한 메서드는 버튼의 동작과 관련된 코드를 추가하는 곳입니다.

  4. setRegisterCell()setDataBind() 메서드가 비어 있습니다. 필요한 경우 셀 등록 및 데이터 바인딩과 관련된 로직을 추가해야 합니다.

  5. required init?(coder: NSCoder) 메서드가 구현되지 않았으며 "init(coder:) has not been implemented"의 fatalError가 포함되어 있습니다. 필요한 경우 이니셜라이저를 구현하여 인터페이스 빌더나 스토리보드를 통해 인스턴스화할 수 있도록 해야 합니다.

이 외에도 더 많은 세부 사항이 존재할 수 있지만 현재 코드로부터 판단하기 어렵습니다. 전체 앱의 구조와 요구 사항을 고려하여 추가적인 개선점을 찾을 수 있습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Home 뷰 UI 구현
3 participants