Files
yingmeng-ios-switf/Pods/Reusable/Sources/View/Reusable.swift
2024-02-21 21:30:13 +08:00

36 lines
1.1 KiB
Swift

/*********************************************
*
* This code is under the MIT License (MIT)
*
* Copyright (c) 2016 AliSoftware
*
*********************************************/
#if canImport(UIKit)
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: AnyObject {
/// 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)
}
}
#endif