Skip to content

Commit

Permalink
๐Ÿ”€ :: (#22) ์ œํ’ˆ ๋ฆฌ์ŠคํŠธ UI
Browse files Browse the repository at this point in the history
  • Loading branch information
jangseoyoung committed Nov 23, 2021
1 parent 60f61a0 commit 0ebe595
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 35 deletions.
8 changes: 1 addition & 7 deletions Sources/View/Product/ProductListViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class ProductListViewController: TabmanViewController {
bar.buttons.customize { (button) in
button.font = .systemFont(ofSize: 12)
}

addBar(bar, dataSource: self, at: .top)
}
}
Expand All @@ -104,27 +104,21 @@ extension ProductListViewController: PageboyViewControllerDataSource, TMBarDataS
switch index {
case 0:
let item = TMBarItem(title: "์ „์ฒด")
item.image = R.image.cU()
return item
case 1:
let item = TMBarItem(title: "GS25")
item.image = R.image.gs25()
return item
case 2:
let item = TMBarItem(title: "CU")
item.image = R.image.cU()
return item
case 3:
let item = TMBarItem(title: "MINI\nSTOP")
item.image = R.image.ministoP()
return item
case 4:
let item = TMBarItem(title: "SEVEN\nELEVEN")
item.image = R.image.seveneleveN()
return item
case 5:
let item = TMBarItem(title: "EMART")
item.image = R.image.emart24()
return item
default:
let item = TMBarItem(title: "")
Expand Down
33 changes: 12 additions & 21 deletions Sources/View/Product/StoreMainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,27 @@
import UIKit
import SnapKit
import Then
import RxSwift

class StoreMainViewController: UIViewController, UIScrollViewDelegate {

let disposeBag = DisposeBag()

class StoreMainViewController: UIViewController {

let productModel = [ProductList]()

let tableView = UITableView().then {
$0.register(ProductTableViewCell.self, forCellReuseIdentifier: "productCell")
$0.backgroundColor = R.color.background()
}

override func viewDidLoad() {
super.viewDidLoad()
setUpSubViews()
tableView.delegate = self
tableView.dataSource = self
tableView.rx
.setDelegate(self)
.disposed(by: disposeBag)
}

private func setUpSubViews() {
view.addSubview(tableView)
tableView.snp.makeConstraints {
Expand All @@ -37,23 +41,10 @@ class StoreMainViewController: UIViewController {

init(index: Int) {
super.init(nibName: nil, bundle: nil)
tableView.tag = index

}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}

extension StoreMainViewController: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return productModel.count
}

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
guard let cell = tableView.dequeueReusableCell(withIdentifier: "productCell", for: indexPath)
as? ProductTableViewCell else { return UITableViewCell() }

return cell
}
}
12 changes: 5 additions & 7 deletions Sources/View/Reuseable/ProductTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ class ProductTableViewCell: UITableViewCell {

// MARK: - public method

public func bind(title: String, price: String, store: [String]) {
// ํ›„์— ํŒŒ๋ผ๋ฏธํ„ฐ๋กœ ๋ฐ์ดํ„ฐ ๋ฐ›์•„์„œ ๋ฐ”์ธ๋”ฉ

// demo data
self.titleLabel.text = "๋ผ์ง€๋ฐ”"
self.priceLabel.text = "โ‚ฉ2500"
self.likeCounterLabel.text = "13"
public func bind(title: String, price: String, likeCount: String, store: [String]) {

self.titleLabel.text = title
self.priceLabel.text = "โ‚ฉ\(price)"
self.likeCounterLabel.text = likeCount
self.setStoreList([.cu, .gs25, .emart24])

self.fireButton.rx.tap
Expand Down

0 comments on commit 0ebe595

Please sign in to comment.