// // Wrapper.swift // SHECommunity // // Created by 林 on 2024/11/25. // import Foundation public class DL {} public class DLWrapper { /// 原始对象 public private(set) var base: Base /// 初始化方法 public init(_ base: Base) { self.base = base } } public protocol DLWrapperCompatible { /// 关联类型 associatedtype WrapperBase /// 类包装器属性 static var dl: DLWrapper.Type { get set } /// 对象包装器属性 var dl: DLWrapper { get set } } extension DLWrapperCompatible { /// 类包装器属性 public static var dl: DLWrapper.Type { get { DLWrapper.self } set {} } /// 对象包装器属性 public var dl: DLWrapper { get { DLWrapper(self) } set {} } } // MARK: - DLWrapperCompatible extension Int: DLWrapperCompatible {} extension Int8: DLWrapperCompatible {} extension Int16: DLWrapperCompatible {} extension Int32: DLWrapperCompatible {} extension Int64: DLWrapperCompatible {} extension UInt: DLWrapperCompatible {} extension UInt8: DLWrapperCompatible {} extension UInt16: DLWrapperCompatible {} extension UInt32: DLWrapperCompatible {} extension UInt64: DLWrapperCompatible {} extension Float: DLWrapperCompatible {} extension Double: DLWrapperCompatible {} extension Bool: DLWrapperCompatible {} extension String: DLWrapperCompatible {} extension Data: DLWrapperCompatible {} extension Date: DLWrapperCompatible {} extension URL: DLWrapperCompatible {} extension URLRequest: DLWrapperCompatible {} extension Array: DLWrapperCompatible {} extension Set: DLWrapperCompatible {} extension Dictionary: DLWrapperCompatible {} extension CGFloat: DLWrapperCompatible {} extension NSObject: DLWrapperCompatible {}