Skip to content

Commit

Permalink
Merge pull request TeamSparker#185 from hyun99999/featrue/164
Browse files Browse the repository at this point in the history
[Fix] TeamSparker#164 - 피드뷰 reloadData 문제
hyun99999 authored Jan 21, 2022

Verified

This commit was signed with the committer’s verified signature.
EasterTheBunny Awbrey Hughlett
2 parents 1d27f6e + c73bab5 commit be150e6
Showing 2 changed files with 26 additions and 15 deletions.
39 changes: 25 additions & 14 deletions Spark-iOS/Spark-iOS/Source/ViewControllers/TabBar/FeedVC.swift
Original file line number Diff line number Diff line change
@@ -41,26 +41,34 @@ class FeedVC: UIViewController {

setLayout()
setCollectionView()

// FIXME: - getFeedListFetchWithAPI 위치 변경
DispatchQueue.main.async {
self.getFeedListFetchWithAPI(lastID: self.feedLastID) {
// self.collectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .bottom, animated: false)
}
}
}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

NotificationCenter.default.post(name: .disappearFloatingButton, object: nil)
tabBarController?.tabBar.isHidden = false
// FIXME: - getFeedListFetchWithAPI를 여기서 호출하는거로 변경
// DispatchQueue.main.async {
// self.getFeedListFetchWithAPI(lastID: self.feedLastID) {
// self.collectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .bottom, animated: false)
// }
// }

feedLastID = -1

feedList.removeAll()
firstList.removeAll()
secondList.removeAll()
thirdList.removeAll()
fourthList.removeAll()
fifthList.removeAll()
sixthList.removeAll()
seventhList.removeAll()

DispatchQueue.main.async {
self.setLoading()
}

DispatchQueue.main.async {
self.getFeedListFetchWithAPI(lastID: self.feedLastID) {
self.collectionView.scrollToItem(at: IndexPath(item: 0, section: 0), at: .bottom, animated: false)
}
}
}

// MARK: - Methods
@@ -169,6 +177,9 @@ extension FeedVC {
switch response {
case .success(let data):
if let feed = data as? Feed {
self.loadingView.stop()
self.loadingBgView.removeFromSuperview()

self.feedList.append(contentsOf: feed.records)
self.setData(datalist: feed.records)
self.collectionView.reloadData()
@@ -186,7 +197,7 @@ extension FeedVC {
}
}

func postFeedLikeWithAPI(recordID: Int) {
private func postFeedLikeWithAPI(recordID: Int) {
FeedAPI.shared.feedLike(recordID: recordID) { response in
switch response {
case .success(let message):
Original file line number Diff line number Diff line change
@@ -293,7 +293,7 @@ class WaitingVC: UIViewController {

@objc
func touchToMore() {
// 더보기 버튼
// 더보기 버튼
}

@objc

0 comments on commit be150e6

Please sign in to comment.