From 3bb1fb799cf7631ef54a5209724e5fca413e6a10 Mon Sep 17 00:00:00 2001 From: Pedro Carrasco Date: Sun, 7 Apr 2019 15:51:19 +0100 Subject: [PATCH] Reverted changes in UITableView/UICollectionView --- Sucrose.podspec | 2 +- Sucrose/Extensions/UICollectionView+Cell.swift | 8 ++++---- Sucrose/Extensions/UITableView+Cell.swift | 8 ++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Sucrose.podspec b/Sucrose.podspec index b195a9e..daae234 100644 --- a/Sucrose.podspec +++ b/Sucrose.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.swift_version = "5.0" s.name = "Sucrose" - s.version = "3.4.1" + s.version = "3.4.2" s.summary = "🍬 Everyday sugar" s.description = "Collection of handy methods & objects" diff --git a/Sucrose/Extensions/UICollectionView+Cell.swift b/Sucrose/Extensions/UICollectionView+Cell.swift index 142dde3..6f95f33 100644 --- a/Sucrose/Extensions/UICollectionView+Cell.swift +++ b/Sucrose/Extensions/UICollectionView+Cell.swift @@ -30,18 +30,18 @@ public extension UICollectionView { register(T.self, forSupplementaryViewOfKind: kind.value, withReuseIdentifier: T.name) } - func dequeue(_ type: T.Type, in indexPath: IndexPath) -> T? { + func dequeue(_ type: T.Type, in indexPath: IndexPath) -> T { guard let cell = dequeueReusableCell(withReuseIdentifier: type.name, for: indexPath) as? T else { - return nil + fatalError("Unable to dequeue \(T.name)") } return cell } - func dequeue(_ type: T.Type, in indexPath: IndexPath, as kind: SupplementaryViewKind) -> T? { + func dequeue(_ type: T.Type, in indexPath: IndexPath, as kind: SupplementaryViewKind) -> T { guard let view = dequeueReusableSupplementaryView(ofKind: kind.value, withReuseIdentifier: T.name, for: indexPath) as? T else { - return nil + fatalError("Unable to dequeue \(T.name)") } return view diff --git a/Sucrose/Extensions/UITableView+Cell.swift b/Sucrose/Extensions/UITableView+Cell.swift index cadad26..427bb21 100644 --- a/Sucrose/Extensions/UITableView+Cell.swift +++ b/Sucrose/Extensions/UITableView+Cell.swift @@ -18,17 +18,17 @@ public extension UITableView { register(T.self, forHeaderFooterViewReuseIdentifier: T.name) } - func dequeue(_ type: T.Type, in indexPath: IndexPath) -> T? { + func dequeue(_ type: T.Type, in indexPath: IndexPath) -> T { guard let cell = self.dequeueReusableCell(withIdentifier: type.name, for: indexPath) as? T else { - return nil + fatalError("Unable to dequeue \(T.name)") } return cell } - func dequeue(_ type: T.Type) -> T? { + func dequeue(_ type: T.Type) -> T { guard let view = self.dequeueReusableHeaderFooterView(withIdentifier: T.name) as? T else { - return nil + fatalError("Unable to dequeue \(T.name)") } return view