37b66ecff8aL182">182
public func navigateToGroup() {
- delegate?.navigateToGroup(GroupItem(json: _items.value[currIndex].toJSON() as [String : AnyObject]))
+ let currItem = _items.value[currIndex]
+ delegate?.navigateToGroup(GroupItem(json: currItem.toJSON() as [String : AnyObject]),
+ photoItems: _items.value.filter { $0.photo_id == currItem.photo_id })
}
public func didSelected() {
@@ -38,7 +38,7 @@ extension HomeCoordinator: HomeViewModelDelegate {
|
||
| 38 | 38 |
let coordinator = PhotoDetailCoordinator(vc, |
| 39 | 39 |
nav: navigationController, |
| 40 | 40 |
viewModel: PhotoDetailViewModel(items: items, currIndex: currIndex)) |
| 41 |
- coordinator.start().subscribe().disposed(by: disposeBag) |
|
| 41 |
+ coordinate(to: coordinator).subscribe().disposed(by: disposeBag) |
|
| 42 | 42 |
navigationController.pushViewController(coordinator.photoDetailViewController) |
| 43 | 43 |
} |
| 44 | 44 |
|
@@ -31,9 +31,9 @@ final class PhotoDetailCoordinator: BaseCoordinator<Void> {
|
||
| 31 | 31 |
} |
| 32 | 32 |
|
| 33 | 33 |
extension PhotoDetailCoordinator: PhotoDetailViewModelDelegate {
|
| 34 |
- func navigateToGroup(_ item: GroupItem) {
|
|
| 34 |
+ func navigateToGroup(_ item: GroupItem, photoItems: [PhotoItem]) {
|
|
| 35 | 35 |
let vc = GroupViewController.instantiate() |
| 36 |
- vc.viewModel = GroupViewModel(groupItem: item) |
|
| 36 |
+ vc.viewModel = GroupViewModel(groupItem: item, items: photoItems) |
|
| 37 | 37 |
let coordinator = GroupCoordinator(vc, |
| 38 | 38 |
navigationController: navigationController, |
| 39 | 39 |
navigationSource: .photoDetail) |