diff --git a/Deartoday/Deartoday/Screen/CheckMessage/Controller/CheckMessageViewController.swift b/Deartoday/Deartoday/Screen/CheckMessage/Controller/CheckMessageViewController.swift index f022c45..c64bb33 100644 --- a/Deartoday/Deartoday/Screen/CheckMessage/Controller/CheckMessageViewController.swift +++ b/Deartoday/Deartoday/Screen/CheckMessage/Controller/CheckMessageViewController.swift @@ -151,9 +151,9 @@ extension CheckMessageViewController: UICollectionViewDelegate { extension CheckMessageViewController { private func getMessageInfo() { - CheckMessageAPI.shared.getCheckMessage { response in - guard let responseData = response else { return } - self.setMessageInfo(response: responseData.data?.lastAnswer ?? []) + CheckMessageAPI.shared.getCheckMessage { [weak self] messageData in + guard let messageData = messageData else { return } + self?.setMessageInfo(response: messageData.data?.lastAnswer ?? []) } } } diff --git a/Deartoday/Deartoday/Screen/CheckTimeTravel/Controller/CheckTimeTravelViewController.swift b/Deartoday/Deartoday/Screen/CheckTimeTravel/Controller/CheckTimeTravelViewController.swift index e190e11..7c5cb3c 100644 --- a/Deartoday/Deartoday/Screen/CheckTimeTravel/Controller/CheckTimeTravelViewController.swift +++ b/Deartoday/Deartoday/Screen/CheckTimeTravel/Controller/CheckTimeTravelViewController.swift @@ -133,10 +133,10 @@ extension CheckTimeTravelViewController: UITableViewDelegate { extension CheckTimeTravelViewController { private func getTimeTravelInfo() { - CheckTimeTravelAPI.shared.getCheckTimeTravel { response in - guard let responseData = response else { return } - self.timeTapes = responseData.data?.timeTravels ?? [] - self.setTimeTravelTapeInfo() + CheckTimeTravelAPI.shared.getCheckTimeTravel { [weak self] tapeData in + guard let tapeData = tapeData else { return } + self?.timeTapes = tapeData.data?.timeTravels ?? [] + self?.setTimeTravelTapeInfo() } } } diff --git a/Deartoday/Deartoday/Screen/CheckTimeTravelDetail/Controller/CheckTimeTravelDetailViewController.swift b/Deartoday/Deartoday/Screen/CheckTimeTravelDetail/Controller/CheckTimeTravelDetailViewController.swift index 31d847b..f740801 100644 --- a/Deartoday/Deartoday/Screen/CheckTimeTravelDetail/Controller/CheckTimeTravelDetailViewController.swift +++ b/Deartoday/Deartoday/Screen/CheckTimeTravelDetail/Controller/CheckTimeTravelDetailViewController.swift @@ -186,12 +186,12 @@ extension CheckTimeTravelDetailViewController: UICollectionViewDelegateFlowLayou // MARK: - Network extension CheckTimeTravelDetailViewController { - func getTravelInfo(timeTravelId: String) { - CheckTimeTravelAPI.shared.getTimeTravelDetail(timeTravelId: timeTravelId) { response in - guard let info = response?.data as? CheckTimeTravelDetailResponse else { return } - self.travelInfo = info - self.dialogs = info.messages - self.collectionView.reloadData() + private func getTravelInfo(timeTravelId: String) { + CheckTimeTravelAPI.shared.getTimeTravelDetail(timeTravelId: timeTravelId) { [weak self] travelData in + guard let travelData = travelData?.data as? CheckTimeTravelDetailResponse else { return } + self?.travelInfo = travelData + self?.dialogs = travelData.messages + self?.collectionView.reloadData() } } } diff --git a/Deartoday/Deartoday/Screen/Main/Controller/MainViewController.swift b/Deartoday/Deartoday/Screen/Main/Controller/MainViewController.swift index 16a79c8..fc88d53 100644 --- a/Deartoday/Deartoday/Screen/Main/Controller/MainViewController.swift +++ b/Deartoday/Deartoday/Screen/Main/Controller/MainViewController.swift @@ -33,7 +33,7 @@ final class MainViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() setUI() - setData() + setDate() setDelegate() setGesture() setBackSwipeGesture() @@ -54,10 +54,6 @@ final class MainViewController: UIViewController { setLayout() } - private func setData() { - setDate() - } - private func setDelegate() { backgroundScrollView.delegate = self } @@ -144,9 +140,9 @@ extension MainViewController: UIScrollViewDelegate { extension MainViewController { private func getMainData() { - MainAPI.shared.getMain { mainData in + MainAPI.shared.getMain { [weak self] mainData in guard let mainData = mainData else { return } - self.setCountLabel(count: mainData.data?.timeTravelCount ?? 0) + self?.setCountLabel(count: mainData.data?.timeTravelCount ?? 0) } } }