Skip to content

Commit

Permalink
Reverted changes in UITableView/UICollectionView
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrommcarrasco committed Apr 7, 2019
1 parent 74ad4fc commit 3bb1fb7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion 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"

Expand Down
8 changes: 4 additions & 4 deletions Sucrose/Extensions/UICollectionView+Cell.swift
Expand Up @@ -30,18 +30,18 @@ public extension UICollectionView {
register(T.self, forSupplementaryViewOfKind: kind.value, withReuseIdentifier: T.name)
}

func dequeue<T: UICollectionViewCell>(_ type: T.Type, in indexPath: IndexPath) -> T? {
func dequeue<T: UICollectionViewCell>(_ 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<T: UICollectionReusableView>(_ type: T.Type, in indexPath: IndexPath, as kind: SupplementaryViewKind) -> T? {
func dequeue<T: UICollectionReusableView>(_ 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
Expand Down
8 changes: 4 additions & 4 deletions Sucrose/Extensions/UITableView+Cell.swift
Expand Up @@ -18,17 +18,17 @@ public extension UITableView {
register(T.self, forHeaderFooterViewReuseIdentifier: T.name)
}

func dequeue<T: UITableViewCell>(_ type: T.Type, in indexPath: IndexPath) -> T? {
func dequeue<T: UITableViewCell>(_ 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<T: UITableViewHeaderFooterView>(_ type: T.Type) -> T? {
func dequeue<T: UITableViewHeaderFooterView>(_ 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
Expand Down

0 comments on commit 3bb1fb7

Please sign in to comment.