Skip to content

Commit

Permalink
[Fix] #319 - 식당 상세 조회 API Response 구조 변경 및 데이터 바인딩
Browse files Browse the repository at this point in the history
위도 경도 카테고리 이미지 추가
서버 대기 중이라 임의 값 넣어둔 상태
  • Loading branch information
EunsuSeo01 committed Dec 25, 2024
1 parent 367d877 commit f17ea81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ struct GetHankkiDetailResponseData: Codable {
let isLiked: Bool
let imageUrls: [String]
let menus: [MenuData]
let latitude: Double = 37.502802
let longitude: Double = 127.0841337
let categoryImageUrl: String = ""
}

struct MenuData: Codable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ final class DetailMapView: BaseView {
addressLabel.do {
$0.attributedText = UILabel.setupAttributedText(
for: PretendardStyle.caption4,
withText: "경기도 수원시 아주대학교 어쩌구",
color: .gray700
)
}
Expand All @@ -127,6 +126,13 @@ final class DetailMapView: BaseView {
}
}

extension DetailMapView {

func bindData(latitude: Double, longitude: Double) {
addressLabel.text = "\(latitude) \(longitude)"
}
}

// MARK: - Private Func

private extension DetailMapView {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,12 @@ private extension HankkiDetailViewController {

hankkiInfoView.bindData(
category: data.category,
categoryImageUrl: data.categoryImageUrl,
name: data.name,
heartCount: String(data.heartCount),
isLiked: data.isLiked
)
// map view bind data 예정
detailMapView.bindData(latitude: data.latitude, longitude: data.longitude)

menuCollectionView.updateLayout(menuSize: data.menus.count)
menuCollectionView.collectionView.reloadData()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ final class HankkiInfoView: BaseView {
$0.backgroundColor = .hankkiWhite
}

categoryImageView.do {
$0.image = .icHomeSelected
}

categoryLabel.do {
$0.attributedText = UILabel.setupAttributedText(for: PretendardStyle.caption4, color: .gray900)
}
Expand Down Expand Up @@ -116,8 +112,9 @@ final class HankkiInfoView: BaseView {

extension HankkiInfoView {

func bindData(category: String, name: String, heartCount: String, isLiked: Bool) {
func bindData(category: String, categoryImageUrl: String, name: String, heartCount: String, isLiked: Bool) {
categoryLabel.text = category
categoryImageView.setKFImage(url: categoryImageUrl)
nameLabel.text = name
if let attributedTitle = UILabel.setupAttributedText(
for: PretendardStyle.body8,
Expand Down

0 comments on commit f17ea81

Please sign in to comment.