You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.0 KiB

5 years ago
  1. /*********************************************
  2. *
  3. * This code is under the MIT License (MIT)
  4. *
  5. * Copyright (c) 2016 AliSoftware
  6. *
  7. *********************************************/
  8. import UIKit
  9. // MARK: Protocol definition
  10. /// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
  11. /// conform to this protocol when they are *not* NIB-based but only code-based
  12. /// to be able to dequeue them in a type-safe manner
  13. public protocol Reusable: class {
  14. /// The reuse identifier to use when registering and later dequeuing a reusable cell
  15. static var reuseIdentifier: String { get }
  16. }
  17. /// Make your `UITableViewCell` and `UICollectionViewCell` subclasses
  18. /// conform to this typealias when they *are* NIB-based
  19. /// to be able to dequeue them in a type-safe manner
  20. public typealias NibReusable = Reusable & NibLoadable
  21. // MARK: - Default implementation
  22. public extension Reusable {
  23. /// By default, use the name of the class as String for its reuseIdentifier
  24. static var reuseIdentifier: String {
  25. return String(describing: self)
  26. }
  27. }