-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReusable.swift
25 lines (20 loc) · 885 Bytes
/
Reusable.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import UIKit
// MARK: Protocol definition
/// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
/// conform to this protocol when they are *not* NIB-based but only code-based
/// to be able to dequeue them in a type-safe manner
public protocol Reusable: class {
/// The reuse identifier to use when registering and later dequeuing a reusable cell
static var reuseIdentifier: String { get }
}
/// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
/// conform to this typealias when they *are* NIB-based
/// to be able to dequeue them in a type-safe manner
public typealias NibReusable = Reusable & NibLoadable
// MARK: - Default implementation
public extension Reusable {
/// By default, use the name of the class as String for its reuseIdentifier
static var reuseIdentifier: String {
return String(describing: self)
}
}