Skip to content

Commit

Permalink
[Syte] Keyneez#46 - HomeViewController μ •λ ¬
Browse files Browse the repository at this point in the history
  • Loading branch information
kpk0616 committed Jan 13, 2023
1 parent aff855e commit bdb3fb0
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions Keyneez/Keyneez/Tab/Home/Controllers/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,24 +50,24 @@ final class HomeViewController: NiblessViewController, NavigationBarProtocol {
}
private var repository: ContentRepository = KeyneezContentRepository()

var datasources: [[HomeContentResponseDto]] = []
var datasources: [[HomeContentResponseDto]] = []
let VCs: [HomeContentViewController] = [HomeContentViewController(), HomeContentViewController(), HomeContentViewController()]

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
super.viewWillAppear(animated)
guard let token = UserSession.shared.accessToken else { return }
repository.getAllContents(token: token) {
[weak self] arr in
guard let self else {return}
self.datasources.append(arr)
DispatchQueue.main.async {
self.VCs.forEach {
$0.contentList = self.datasources[0]
$0.recommendContentCollectionView.reloadData()
}
}
}
[weak self] arr in
guard let self else {return}
self.datasources.append(arr)
DispatchQueue.main.async {
self.VCs.forEach {
$0.contentList = self.datasources[0]
$0.recommendContentCollectionView.reloadData()
}
}
}
}
}

// MARK: - extra functions
Expand Down Expand Up @@ -129,8 +129,8 @@ extension HomeViewController {
viewController.didMove(toParent: self)
}
private func remove(asChildViewController viewController: UIViewController) {
viewController.willMove(toParent: nil)
viewController.view.removeFromSuperview()
viewController.removeFromParent()
viewController.willMove(toParent: nil)
viewController.view.removeFromSuperview()
viewController.removeFromParent()
}
}

0 comments on commit bdb3fb0

Please sign in to comment.