From 6086d0c5be97620b15217a047416fad939d7efcf Mon Sep 17 00:00:00 2001 From: Sejin Lee Date: Thu, 12 Jan 2023 21:28:51 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=20#99=20-=20=EC=BD=94=EC=8A=A4=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=20=EC=84=9C=EB=B2=84=20=ED=86=B5=EC=8B=A0=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CourseDiscovery/Views/VC/CourseSearchVC.swift | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseSearchVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseSearchVC.swift index 60c43279..e8aeea67 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseSearchVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/CourseDiscovery/Views/VC/CourseSearchVC.swift @@ -32,6 +32,7 @@ final class CourseSearchVC: UIViewController { private let dividerView = UIView().then { $0.backgroundColor = .g5 } + private lazy var mapCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .vertical @@ -103,6 +104,7 @@ extension CourseSearchVC { } private func setData(data: [PublicCourse]) { self.courseList = data + self.emptyDataView.isHidden = !data.isEmpty mapCollectionView.reloadData() } } @@ -130,7 +132,9 @@ extension CourseSearchVC { make.top.equalTo(self.dividerView.snp.bottom) make.leading.trailing.bottom.equalTo(self.view.safeAreaLayoutGuide) } + mapCollectionView.addSubview(emptyDataView) + emptyDataView.snp.makeConstraints { make in make.center.equalToSuperview() } @@ -194,6 +198,7 @@ extension CourseSearchVC: UICollectionViewDelegateFlowLayout { extension CourseSearchVC: CustomNavigationBarDelegate { func searchButtonDidTap(text: String) { + guard !text.isEmpty else { return } searchCourseWithKeyword(keyword: text) self.keyword = text } @@ -224,6 +229,7 @@ extension CourseSearchVC { guard let data = responseDto.data else { return } self.setData(data: data.publicCourses) } catch { + self.setData(data: []) print(error.localizedDescription) } }