From 367b31482b1bd32134467a4f80e86bfb39a5819a Mon Sep 17 00:00:00 2001 From: Zachary Orr Date: Sat, 22 Feb 2020 10:21:04 -0500 Subject: [PATCH] Fix crash when event has multiple webcasts --- .../Events/Event/EventInfoViewController.swift | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/the-blue-alliance-ios/View Controllers/Events/Event/EventInfoViewController.swift b/the-blue-alliance-ios/View Controllers/Events/Event/EventInfoViewController.swift index ba0732597..6050f3b2e 100755 --- a/the-blue-alliance-ios/View Controllers/Events/Event/EventInfoViewController.swift +++ b/the-blue-alliance-ios/View Controllers/Events/Event/EventInfoViewController.swift @@ -18,13 +18,13 @@ private enum EventInfoSection: Int { case link } -private enum EventInfoItem { +private enum EventInfoItem: Hashable { case title case alliances case districtPoints case stats case awards - case webcast + case webcast(Webcast) case website case twitter case youtube @@ -147,7 +147,7 @@ class EventInfoViewController: TBATableViewController, Observable { snapshot.appendItems(detailItems, toSection: .detail) // Webcasts - let webcasts = event.webcasts.compactMap { $0.urlString }.map { _ in EventInfoItem.webcast } + let webcasts = event.webcasts.map { EventInfoItem.webcast($0) } if !webcasts.isEmpty, event.isHappeningThisWeek { snapshot.appendSections([.webcast]) snapshot.appendItems(webcasts, toSection: .webcast) @@ -201,8 +201,7 @@ class EventInfoViewController: TBATableViewController, Observable { delegate?.showStats() case .awards: delegate?.showAwards() - case .webcast: - let webcast = event.webcasts[indexPath.row] + case .webcast(let webcast): urlString = webcast.urlString case .website: urlString = event.website