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

지역설정 화면 구현 #25

Merged
merged 13 commits into from
Mar 20, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Feat]: TableViewUpdate
Jeon0976 committed Feb 27, 2024
commit 2dc6d4fa1578c59ea19fd45b1aa3bfe54053a91f
Original file line number Diff line number Diff line change
@@ -87,7 +87,7 @@ final class RegionFilterViewController: NagazaBaseViewController {

override func bindViewModel() {
let mainRegionSelected = mainRegionTableView.rx.itemSelected
.map {
.map {
return $0.row
}
.asDriver(onErrorJustReturn: 0)
@@ -105,12 +105,13 @@ final class RegionFilterViewController: NagazaBaseViewController {
cellType: SubRegionTableViewCell.self)
) { index, region, cell in
cell.bind(region: region, count: "500")

}
.disposed(by: disposeBag)

output.reloadMainRegions
.drive(onNext: { [weak self] _ in
self?.mainRegionTableView.reloadData()
// self?.mainRegionTableView.reloadData()
})
.disposed(by: disposeBag)
}
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ final class MainRegionTableViewCell: UITableViewCell {
}

func bind(region: String, isSelected: Bool) {
print(region, "Test", isSelected)
regionLabel.text = region

self.backgroundColor = isSelected ? NagazaAsset.Colors.white.color : NagazaAsset.Colors.gray8.color
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ struct RegionFilterViewModelActions {
final class RegionFilterViewModel: ViewModelType {
private let actions: RegionFilterViewModelActions!

private var mainRegions: [(Region, Bool)] = [
var mainRegions: [(Region, Bool)] = [
(.nationwide, true),
(.seoul, false),
(.gyeonggi, false),
@@ -26,8 +26,11 @@ final class RegionFilterViewModel: ViewModelType {
(.jeolla, false),
(.gangwon, false),
(.jeju, false)
]

] {
didSet {
print(mainRegions)
}
}
struct Input {
let mainRegionSelection: Driver<Int>
let subRegionSelection: Driver<String>
Original file line number Diff line number Diff line change
@@ -93,9 +93,10 @@ final class HomeViewController: NagazaBaseViewController {
let mapButtonItem = UIBarButtonItem(
image: NagazaAsset.Images.icMapGray.image,
style: .plain,
target: nil,
action: nil
target: self,
action: #selector(test(_:))
)

let searchButtonItem = UIBarButtonItem(
image: NagazaAsset.Images.icSearchGray.image,
style: .plain,
@@ -108,6 +109,16 @@ final class HomeViewController: NagazaBaseViewController {
navigationItem.rightBarButtonItem = searchButtonItem
}

@objc private func test(_ sender: UIButton) {
print("Test")
let action = RegionFilterViewModelActions()
let viewModel = RegionFilterViewModel(actions: action)

let VC = RegionFilterViewController.create(with: viewModel)

self.present(VC, animated: true)
}

override func makeUI() {
view.addSubview(scrollView)
scrollView.snp.makeConstraints {