This repository has been archived by the owner on Aug 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #58 from k-nh/feature/home
기능추가🔧 #42: 주변맛집 관련 api 연동 및 MVVM 리팩토링
- Loading branch information
Showing
14 changed files
with
148 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
EatDa/Scenes/Home/SubComponents/AroundView/AroundCollectionView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// AroundCollectionView.swift | ||
// EatDa | ||
// | ||
// Created by 김나희 on 6/26/22. | ||
// | ||
|
||
import RxSwift | ||
import RxCocoa | ||
|
||
final class AroundCollectionView: UICollectionView { | ||
let disposeBag = DisposeBag() | ||
|
||
override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) { | ||
let layout = UICollectionViewFlowLayout() | ||
layout.scrollDirection = .horizontal | ||
layout.sectionInset = UIEdgeInsets(top: 0.0, left: 14.68, bottom: 0.0, right: 16.0) | ||
layout.itemSize = CGSize(width: AroundCollectionViewCell.width , height: AroundCollectionViewCell.height) | ||
|
||
super.init(frame: frame, collectionViewLayout: layout) | ||
|
||
attribute() | ||
bind(RestaurantListViewModel()) | ||
} | ||
|
||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func attribute() { | ||
self.backgroundColor = .systemBackground | ||
self.showsHorizontalScrollIndicator = false | ||
self.register(AroundCollectionViewCell.self, forCellWithReuseIdentifier: "AroundCollectionViewCell") | ||
} | ||
|
||
|
||
func bind(_ viewModel: RestaurantListViewModel) { | ||
viewModel.aroundRestaurantData | ||
.drive(self.rx.items) { collectionView, row, data in | ||
let indexPath = IndexPath(row: row, section: 0) | ||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "AroundCollectionViewCell", for: indexPath) as! AroundCollectionViewCell | ||
cell.setData(data) | ||
|
||
return cell | ||
} | ||
.disposed(by: disposeBag) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
EatDa/Scenes/Home/SubComponents/AroundView/AroundDetail/AroundDetailViewModel.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// AroundDetailViewModel.swift | ||
// EatDa | ||
// | ||
// Created by 김나희 on 6/26/22. | ||
// | ||
|
||
import Foundation | ||
import RxSwift | ||
|
||
struct AroundDetailViewModel { | ||
let listViewModel = RestaurantListViewModel() | ||
} |
Oops, something went wrong.