-
Notifications
You must be signed in to change notification settings - Fork 0
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
레시피 리스트UI를 생성해보았습니다. #9
Changes from 1 commit
6764431
10c4c85
69b6ba0
b740a44
68d17da
145bd41
db5e2ef
7a3ba89
db38695
22ee02b
6edb8bb
2a6372c
2be84eb
ee35fb9
34985f7
24d0856
24a71e2
72e9fe8
cf0c78c
15f80f0
833b474
be060c4
99c274e
c0bd5a0
05b2a58
52d89ea
1a760ca
3c03347
7077713
c1bc9a0
4eb8154
e57455d
f0115b8
d3dcc4e
76fdeba
e1a3fc2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// RecipeListView.swift | ||
// HomeCafeRecipes | ||
// | ||
// Created by 김건호 on 6/10/24. | ||
// | ||
|
||
import UIKit | ||
|
||
class RecipeListView: UIView { | ||
|
||
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) | ||
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. collectionView를 internal로 선언한 이유가 있을까요? 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. ViewController에서 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. [22ee02b] 수정했습니다 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. delegate와 dataSource는 view에서 같이 구현 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. @GeonH0 이 부분은 아직 수정전이신가요~? 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. @f-lab-barry 내일 오전 중으로 수정 커밋 올리겠습니다! 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. |
||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setupUI() | ||
setupLayout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setupUI() { | ||
backgroundColor = .white | ||
addSubview(collectionView) | ||
collectionView.register(RecipeListViewCell.self, forCellWithReuseIdentifier: "RecipeCell") | ||
configureCollectionView() | ||
} | ||
|
||
private func setupLayout() { | ||
collectionView.translatesAutoresizingMaskIntoConstraints = false | ||
NSLayoutConstraint.activate([ | ||
collectionView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), | ||
collectionView.leadingAnchor.constraint(equalTo: leadingAnchor), | ||
collectionView.trailingAnchor.constraint(equalTo: trailingAnchor), | ||
collectionView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor) | ||
]) | ||
} | ||
|
||
private func configureCollectionView() { | ||
let layout = UICollectionViewFlowLayout() | ||
layout.itemSize = CGSize(width: UIScreen.main.bounds.width - 20, height: 200) | ||
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. 마진 값을 변수로 빼서 가독성을 더 높여보는건 어때요? 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. [2be84eb] 변경했습니다 |
||
layout.minimumLineSpacing = 10 | ||
layout.minimumInteritemSpacing = 10 | ||
collectionView.collectionViewLayout = layout | ||
} | ||
} |
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.
여기도요~
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.
[7a3ba89] 변경했습니다