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

[Design] #3 - 검색 UI 구현 #27

Merged
merged 15 commits into from
Jul 12, 2022
Merged

Conversation

0inn
Copy link
Contributor

@0inn 0inn commented Jul 11, 2022

🔥 Pull requests

⛳️ 작업한 브랜치

👷 작업한 내용

  • 검색창 UI 구현
  • 최근검색어 Realm 구현
  • 자동완성어 UI 구현

🚨 참고 사항

Realm 구현한 부분 좀 봐주세용 ..
최근검색어의 경우에 0번째 리스트에 추가하는 식으로 했습니다.

📸 스크린샷

기능 스크린샷
최근검색어
자동완성어
검색

📟 관련 이슈

@0inn 0inn added Design UI 및 Layout 작업 ☁️Jenny labels Jul 11, 2022
@0inn 0inn self-assigned this Jul 11, 2022
Copy link
Member

@i-colours-u i-colours-u left a comment

Choose a reason for hiding this comment

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

고생하셨습니다 ^___^


import SnapKit

protocol SearchRecentTVCDelegate: AnyObject {
Copy link
Member

Choose a reason for hiding this comment

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

p5; 여기에 AnyObject 타입 붙인 디테일 좋네여 ^_^

Comment on lines 21 to 23

weak var delegate: SearchRecentTVCDelegate?

Copy link
Member

Choose a reason for hiding this comment

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

p5;
나중에 한번 여기서 줄 지워주세여!

import SnapKit

protocol SearchRecentTVCDelegate: AnyObject {
func SearchRecentTVCDelete(index: Int)
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 SearchVC: UITextFieldDelegate {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
addSearchRecent(title: textField.text ?? "")
Copy link
Member

Choose a reason for hiding this comment

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

p4; 빈 경우에 추가하면 안될것 같아서 여기서 옵셔널 바인딩으로 textField.text가 있는지 체크하고 addSearrchRecent 호출하면 좋을것 같아요!!!

Copy link
Member

@L-j-h-c L-j-h-c left a comment

Choose a reason for hiding this comment

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

Realm이랑 Snapkit으로 깔끔하게 구현해주셨네요~~! 수고 많으셨습니다! 코드 스타일이 점 비슷한건 착각인가.. 코드리뷰 반영하시고 나면 어프루브하겠습니다~

Comment on lines 53 to 57
// MARK: - @objc Methods

@objc func deleteSearch() {
delegate?.SearchRecentTVCDelete(index: index)
}
Copy link
Member

Choose a reason for hiding this comment

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

p4;

여기도 그냥 익스텐션으로 빼주세요~ 안쪽에는 프로퍼티, 컴포넌트, 라이프 사이클 관련만 있으면 될 것 같습니당!


let realm = try? Realm()

var searchFlag: Bool = false {
Copy link
Member

Choose a reason for hiding this comment

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

p4;

searchFlag보다 조금 더 구체적으로 이름을 바꿀 수 있을 것 같아요! searchStarted 라던가... Flag라는 말이 조금 모호하다는 느낌이 있네용~~

isEmptyTextField()
} else {
searchTextField.rightViewMode = .always
searchTableView.tableHeaderView = nil
Copy link
Member

Choose a reason for hiding this comment

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

p5;

👍 👍

Comment on lines 177 to 178
SearchRecentTVC.register(target: searchTableView)
SearchTVC.register(target: searchTableView)
Copy link
Member

Choose a reason for hiding this comment

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

p4;

사실 중요한 부분은 아니지만 컨벤션 만들었으니까 이부분 registerCell에 넣어주세요~

Comment on lines 191 to 194
searchTextField.rightViewMode = .never
topLabel.text = "최근 검색어"
searchTableView.tableHeaderView = topView
searchFlag = false
Copy link
Member

Choose a reason for hiding this comment

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

Q;

검색어가 없을 경우 최근검색어가 자동으로 뜨도록 구현하기로 정해졌나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

없는 경우가 "텍스트를 입력하다가 다시 지워서 텍스트 필드가 비워진 상태"를 뜻하는 거 맞나요 ?
당연하게 이렇게 구현했는데 기디 선생님들께 다시 여쭤보겠습니다 ..

Comment on lines 226 to 236
if searchFlag {
guard let cell = tableView.dequeueReusableCell(withIdentifier: SearchTVC.className, for: indexPath) as? SearchTVC else { return UITableViewCell() }
cell.setData(data: searchRecentList[indexPath.row])
return cell
} else {
guard let cell = tableView.dequeueReusableCell(withIdentifier: SearchRecentTVC.className, for: indexPath) as? SearchRecentTVC else { return UITableViewCell() }
cell.setData(data: searchRecentList[indexPath.row])
cell.index = indexPath.row
cell.delegate = self
return cell
}
Copy link
Member

Choose a reason for hiding this comment

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

p5;

셀 두개 사용해서 잘 구현해 주셨습니다! 다른 방법으로 하나의 셀에 boolFlag를 두고 재사용할 수 있는 방법도 있는데, 뭐가 더 좋은 방법인지는 저도 잘 모르겠네용

Copy link
Contributor Author

Choose a reason for hiding this comment

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

오 그런 방법도 있겠네요 ! 감사합니다 ㅎ ㅎ

Copy link
Member

@L-j-h-c L-j-h-c left a comment

Choose a reason for hiding this comment

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

👍

@0inn 0inn merged commit 00a46d2 into Health-Food-Me:develop Jul 12, 2022
@0inn 0inn deleted the feature/#3 branch July 12, 2022 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Design UI 및 Layout 작업 ☁️Jenny
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Design] 검색 UI 구현
3 participants