Skip to content

Commit

Permalink
Feat:sparkles:: #75 Connecting delegate at Seg
Browse files Browse the repository at this point in the history
- HistoryViewController의 Delegate를 SegmentViewController에 연결.
  • Loading branch information
JUNY0110 committed May 2, 2023
1 parent ec62cf9 commit c27e882
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
7 changes: 6 additions & 1 deletion GiwazipClient/Coordinators/SegmentCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
protocol SegmentCoordinatorDelegate {
func presentPostingView()
func pushToSettingViewController()
func pushToPostViewController()
}

class SegmentCoordinator: BaseCoordinator, SegmentViewControllerDelegate {
Expand All @@ -28,8 +29,12 @@ class SegmentCoordinator: BaseCoordinator, SegmentViewControllerDelegate {
func presentPostingPhotoViewController() {
self.delegate?.presentPostingView()
}

func pushToSettingViewController() {
self.delegate?.pushToSettingViewController()
}

func pushToPostViewController() {
delegate?.pushToPostViewController()
}
}
1 change: 1 addition & 0 deletions GiwazipClient/Views/HistoryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ extension HistoryViewController: UICollectionViewDelegate {

applyPostSnapshot()
} else {
delegate?.pushToPostViewController()
print("현재 클릭된 부분은 게시물의 \(indexPath)입니다.")
}
}
Expand Down
15 changes: 12 additions & 3 deletions GiwazipClient/Views/SegmentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ import SnapKit
protocol SegmentViewControllerDelegate: AnyObject {
func presentPostingPhotoViewController()
func pushToSettingViewController()
func pushToPostViewController()
}

class SegmentViewController: BaseViewController {
class SegmentViewController: BaseViewController, HistoryViewControllerDelegate {

// MARK: - Property

Expand Down Expand Up @@ -65,10 +66,14 @@ class SegmentViewController: BaseViewController {
return $0
}(UIView())

private let workView = HistoryViewController()
private lazy var workView: HistoryViewController = {
$0.delegate = self
return $0
}(HistoryViewController())

private let inquiryView: HistoryViewController = {
private lazy var inquiryView: HistoryViewController = {
$0.isWorkView = false
$0.delegate = self
return $0
}(HistoryViewController())

Expand Down Expand Up @@ -222,6 +227,10 @@ class SegmentViewController: BaseViewController {
@objc func didTapSettingButton() {
delegate?.pushToSettingViewController()
}

func pushToPostViewController() {
delegate?.pushToPostViewController()
}
}

// MARK: - UIPageViewControllerDelegate, UIPageViewControllerDataSource
Expand Down

0 comments on commit c27e882

Please sign in to comment.