I also had this issue in a UIColor
extension, my app is entirely made with swift except for some frameworks that use Objective-c so I have no problem in declaring the var
as @nonobjc
:
extension UIColor {
@nonobjc static var lol: UIColor {
return UIColor.red
}
}
From the apple docs:
The nonobjc attribute tells the compiler to make the declaration unavailable in Objective-C code...
Since this code is unavailable to Objective-C the warning disappears.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…