Closed KellyCoder closed 2 years ago
Swift项目中调用以下闭包 QMUIThemeManagerCenter.defaultThemeManager.identifierForTrait = { (trait) -> (NSObject) in
return "" as NSObject }
会包此错误 Cannot assign value of type '(UITraitCollection) -> (NSObject)' to type '((UITraitCollection) -> NSCopying & NSObjectProtocol)?' 怎么调用方式才是正确的呢?
错误提示很明显 返回一个 NSCopying & NSObjectProtocol) 即: QMUIThemeManagerCenter.defaultThemeManager.identifierForTrait = { (trait) -> (NSCopying & NSObjectProtocol) in return "" as NSString }
NSCopying & NSObjectProtocol)
return "" as NSString
Swift项目中调用以下闭包 QMUIThemeManagerCenter.defaultThemeManager.identifierForTrait = { (trait) -> (NSObject) in
会包此错误 Cannot assign value of type '(UITraitCollection) -> (NSObject)' to type '((UITraitCollection) -> NSCopying & NSObjectProtocol)?' 怎么调用方式才是正确的呢?