Skip to content
This repository was archived by the owner on Aug 28, 2022. It is now read-only.

Commit cae2136

Browse files
authored
Merge branch 'develop' into feature/matziptalk
2 parents 402f4ed + d89f022 commit cae2136

22 files changed

+1433
-642
lines changed

EatDa.xcodeproj/project.pbxproj

+650-618
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"filename" : "Group 26862.png",
5+
"idiom" : "universal",
6+
"scale" : "1x"
7+
},
8+
{
9+
"filename" : "Group [email protected]",
10+
"idiom" : "universal",
11+
"scale" : "2x"
12+
},
13+
{
14+
"filename" : "Group [email protected]",
15+
"idiom" : "universal",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"author" : "xcode",
21+
"version" : 1
22+
}
23+
}
Loading
Loading
Loading

EatDa/Scenes/Home/HomeViewController.swift

+48-17
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,16 @@ class HomeViewController: UIViewController {
1414
let disposeBag = DisposeBag()
1515
let homeViewModel = HomeViewModel()
1616

17+
// MARK: - UIComponent
1718
private let scrollView = UIScrollView()
1819
private let contentView = UIView()
1920

20-
// MARK: - UIComponent
21+
let titleSectionView = TitleSectionView()
22+
let filterSectionView = FilterSectionView()
23+
let recommendSectionView = RecommendSectionView()
24+
let aroundSectionView = AroundSectionView()
25+
let mapSectionView = MapSectionView()
26+
2127
private lazy var searchBarButton: UIBarButtonItem = {
2228
let button = UIBarButtonItem()
2329
button.image = UIImage(imageLiteralResourceName: "search")
@@ -36,12 +42,6 @@ class HomeViewController: UIViewController {
3642

3743
stackView.distribution = .equalSpacing
3844
stackView.spacing = 0.0
39-
40-
let titleSectionView = TitleSectionView()
41-
let filterSectionView = FilterSectionView()
42-
let recommendSectionView = RecommendSectionView()
43-
let aroundSectionView = AroundSectionView()
44-
let mapSectionView = MapSectionView()
4545

4646
// 임의의 뷰 추가하여 스크롤 뷰 아래화면 끝까지 잘보이게
4747
let spacingView = UIView()
@@ -69,17 +69,28 @@ class HomeViewController: UIViewController {
6969
tabBarController?.tabBar.isHidden = false
7070
}
7171

72-
@objc func showDetail(_ sender: AnyObject?){
73-
let vc = RestaurantDetailViewController()
74-
self.navigationController?.pushViewController(vc, animated: true)
75-
}
76-
77-
7872
func bind(_ viewModel: HomeViewModel) {
7973
searchBarButton.rx.tap
8074
.bind(to: viewModel.searchButtonTapped)
8175
.disposed(by: disposeBag)
8276

77+
noticeBarButton.rx.tap
78+
.bind(to: viewModel.noticeButtonTapped)
79+
.disposed(by: disposeBag)
80+
81+
filterSectionView.applyButton.rx.tap
82+
.bind(to: viewModel.filterButtonTapped)
83+
.disposed(by: disposeBag)
84+
85+
recommendSectionView.showAllButton.rx.tap
86+
.bind(to: viewModel.recommendDetailButtonTapped)
87+
.disposed(by: disposeBag)
88+
89+
aroundSectionView.showAllButton.rx.tap
90+
.bind(to: viewModel.aroundDetailButtonTapped)
91+
.disposed(by: disposeBag)
92+
93+
8394
viewModel.pushSearchViewController
8495
.drive(onNext: { viewModel in
8596
let viewController = SearchViewController()
@@ -88,10 +99,6 @@ class HomeViewController: UIViewController {
8899
})
89100
.disposed(by: disposeBag)
90101

91-
noticeBarButton.rx.tap
92-
.bind(to: viewModel.noticeButtonTapped)
93-
.disposed(by: disposeBag)
94-
95102
viewModel.pushNoticeViewController
96103
.drive(onNext: { viewModel in
97104
let viewController = NoticeViewController()
@@ -100,7 +107,31 @@ class HomeViewController: UIViewController {
100107
})
101108
.disposed(by: disposeBag)
102109

110+
viewModel.filterButtonTapped
111+
.asDriver(onErrorDriveWith: .empty())
112+
.drive(onNext: {
113+
let viewController = FilterDetailViewController()
114+
//viewController.bind(viewModel)
115+
self.show(viewController, sender: nil)
116+
})
117+
.disposed(by: disposeBag)
118+
119+
viewModel.recommendDetailButtonTapped
120+
.asDriver(onErrorDriveWith: .empty())
121+
.drive(onNext: {
122+
let viewController = RecommendDetailViewController()
123+
self.show(viewController, sender: nil)
124+
})
125+
.disposed(by: disposeBag)
103126

127+
viewModel.aroundDetailButtonTapped
128+
.asDriver(onErrorDriveWith: .empty())
129+
.drive(onNext: {
130+
let viewController = AroundDetailViewController()
131+
//viewController.bind(viewModel)
132+
self.show(viewController, sender: nil)
133+
})
134+
.disposed(by: disposeBag)
104135
}
105136
}
106137

EatDa/Scenes/Home/HomeViewModel.swift

+4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ struct HomeViewModel {
1414

1515
let noticeButtonTapped = PublishRelay<Void>()
1616
let pushNoticeViewController: Driver<NoticeViewModel>
17+
18+
let recommendDetailButtonTapped = PublishRelay<Void>()
19+
let aroundDetailButtonTapped = PublishRelay<Void>()
20+
let filterButtonTapped = PublishRelay<Void>()
1721

1822
init() {
1923
let searchViewModel = SearchViewModel()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// AroundDetailViewController.swift
3+
// EatDa
4+
//
5+
// Created by 김나희 on 2022/03/26.
6+
//
7+
8+
import UIKit
9+
10+
final class AroundDetailViewController: UIViewController {
11+
12+
// MARK: - UIComponent
13+
private lazy var searchBarButton: UIBarButtonItem = {
14+
let button = UIBarButtonItem()
15+
button.image = UIImage(imageLiteralResourceName: "search")
16+
return button
17+
}()
18+
19+
private lazy var noticeBarButton: UIBarButtonItem = {
20+
let button = UIBarButtonItem()
21+
button.image = UIImage(imageLiteralResourceName: "bell")
22+
return button
23+
}()
24+
25+
private lazy var emptyHeaderView: UITableViewHeaderFooterView = {
26+
let headerView = UITableViewHeaderFooterView()
27+
return headerView
28+
}()
29+
30+
private lazy var aroundTableView: UITableView = {
31+
let tableview = UITableView()
32+
tableview.backgroundColor = .systemBackground
33+
tableview.rowHeight = 87.34
34+
tableview.separatorColor = .lightGray
35+
tableview.tableHeaderView = emptyHeaderView
36+
37+
// api 연결할때 rx로 코드 변경할 예정
38+
tableview.delegate = self
39+
tableview.dataSource = self
40+
41+
tableview.register(RestaurantTableViewCell.self, forCellReuseIdentifier: "RestaurantTableViewCell")
42+
43+
return tableview
44+
}()
45+
46+
override func viewDidLoad() {
47+
super.viewDidLoad()
48+
setLayout()
49+
}
50+
51+
52+
}
53+
54+
extension AroundDetailViewController: UITableViewDataSource, UITableViewDelegate{
55+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
56+
return 4
57+
}
58+
59+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
60+
let cell = tableView.dequeueReusableCell(withIdentifier: "RestaurantTableViewCell", for: indexPath) as? RestaurantTableViewCell
61+
cell?.separatorInset = UIEdgeInsets.zero
62+
cell?.setupLayout()
63+
64+
return cell ?? UITableViewCell()
65+
}
66+
67+
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
68+
return 97.34
69+
}
70+
71+
}
72+
73+
private extension AroundDetailViewController {
74+
func setLayout() {
75+
setNavigation()
76+
view.addSubview(aroundTableView)
77+
aroundTableView.snp.makeConstraints {
78+
$0.leading.trailing.bottom.equalToSuperview()
79+
$0.top.equalToSuperview().inset(30.0)
80+
}
81+
}
82+
83+
func setNavigation() {
84+
self.navigationItem.title = "주변 맛집"
85+
self.navigationItem.rightBarButtonItems = [noticeBarButton, searchBarButton]
86+
let backButtonImage = UIImage(named: "back")?.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: -15, bottom: 0, right: 0))
87+
self.navigationController?.navigationBar.backIndicatorImage = backButtonImage
88+
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = backButtonImage
89+
self.navigationController?.navigationBar.topItem?.title = ""
90+
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.font: UIFont.myBoldSystemFont(ofSize: 16)]
91+
}
92+
93+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
//
2+
// AroundDetailViewController.swift
3+
// EatDa
4+
//
5+
// Created by 김나희 on 2022/03/26.
6+
//
7+
8+
import UIKit
9+
10+
final class AroundDetailViewController: UIViewController {
11+
12+
// MARK: - UIComponent
13+
private lazy var searchBarButton: UIBarButtonItem = {
14+
let button = UIBarButtonItem()
15+
button.image = UIImage(imageLiteralResourceName: "search")
16+
return button
17+
}()
18+
19+
private lazy var noticeBarButton: UIBarButtonItem = {
20+
let button = UIBarButtonItem()
21+
button.image = UIImage(imageLiteralResourceName: "bell")
22+
return button
23+
}()
24+
25+
private lazy var emptyHeaderView: UITableViewHeaderFooterView = {
26+
let headerView = UITableViewHeaderFooterView()
27+
return headerView
28+
}()
29+
30+
private lazy var aroundTableView: UITableView = {
31+
let tableview = UITableView()
32+
tableview.backgroundColor = .systemBackground
33+
tableview.rowHeight = 87.34
34+
tableview.separatorColor = .lightGray
35+
tableview.tableHeaderView = emptyHeaderView
36+
37+
// api 연결할때 rx로 코드 변경할 예정
38+
tableview.delegate = self
39+
tableview.dataSource = self
40+
41+
tableview.register(RestaurantTableViewCell.self, forCellReuseIdentifier: "RestaurantTableViewCell")
42+
43+
return tableview
44+
}()
45+
46+
override func viewDidLoad() {
47+
super.viewDidLoad()
48+
setLayout()
49+
}
50+
51+
52+
}
53+
54+
extension AroundDetailViewController: UITableViewDataSource, UITableViewDelegate{
55+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
56+
return 4
57+
}
58+
59+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
60+
let cell = tableView.dequeueReusableCell(withIdentifier: "RestaurantTableViewCell", for: indexPath) as? RestaurantTableViewCell
61+
cell?.separatorInset = UIEdgeInsets.zero
62+
cell?.setupLayout()
63+
64+
return cell ?? UITableViewCell()
65+
}
66+
67+
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
68+
return 97.34
69+
}
70+
71+
}
72+
73+
private extension AroundDetailViewController {
74+
func setLayout() {
75+
setNavigation()
76+
view.addSubview(aroundTableView)
77+
aroundTableView.snp.makeConstraints {
78+
$0.leading.trailing.bottom.equalToSuperview()
79+
$0.top.equalToSuperview().inset(30.0)
80+
}
81+
}
82+
83+
func setNavigation() {
84+
self.navigationItem.title = "주변 맛집"
85+
self.navigationItem.rightBarButtonItems = [noticeBarButton, searchBarButton]
86+
let backButtonImage = UIImage(named: "back")?.withAlignmentRectInsets(UIEdgeInsets(top: 0, left: -15, bottom: 0, right: 0))
87+
self.navigationController?.navigationBar.backIndicatorImage = backButtonImage
88+
self.navigationController?.navigationBar.backIndicatorTransitionMaskImage = backButtonImage
89+
self.navigationController?.navigationBar.topItem?.title = ""
90+
self.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.font: UIFont.myBoldSystemFont(ofSize: 16)]
91+
}
92+
93+
}

EatDa/Scenes/Home/SubComponents/AroundView/AroundSectionView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class AroundSectionView: UIView {
3838
return button
3939
}()
4040

41-
private lazy var showAllButton: UIButton = {
41+
lazy var showAllButton: UIButton = {
4242
let button = UIButton()
4343
button.setTitle("전체 보기", for: .normal)
4444
button.setTitleColor(.label, for: .normal)

0 commit comments

Comments
 (0)