From daee1f1b5c739f42ba54a1ebbb9655f5034e315f Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Sun, 17 Jul 2022 01:56:43 +1000 Subject: 'weak self' stuff --- foray/Scenes/ForayTableViewController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'foray/Scenes') diff --git a/foray/Scenes/ForayTableViewController.swift b/foray/Scenes/ForayTableViewController.swift index 13b9dea..a29088c 100644 --- a/foray/Scenes/ForayTableViewController.swift +++ b/foray/Scenes/ForayTableViewController.swift @@ -47,7 +47,9 @@ class ForayTableViewController: UITableViewController, Coordinated { } func reloadApiData() { - presenter.fetch(receiver: { (data: [PenguinItemViewModel]) in + presenter.fetch { [weak self] (data: [PenguinItemViewModel]) in + guard let self = self else { return } + let groups = Dictionary(grouping: data) { $0.year } self.sections = groups.map { (key, values) in return YearSection(year: key, items: values) @@ -58,7 +60,7 @@ class ForayTableViewController: UITableViewController, Coordinated { self.tableView.reloadData() self.refreshControl?.endRefreshing() self.coordinator?.hideLoading() - }) + } } // MARK: - Table view data source -- cgit