小编Tha*_*ran的帖子

如何修复“优化机会”

我正在使用 xcode 12。我编写了扩展 UI 视图,如下所示:

@IBInspectable
public var shadowRadius: CGFloat {
    get {
        return layer.shadowRadius
    }
    set {
        layer.shadowRadius = newValue
    }
}

@IBInspectable
public var shadowOpacity: Float {
    get {
        return layer.shadowOpacity
    }
    set {
         layer.shadowOpacity = newValue
    }
}

@IBInspectable
public var shadowOffset: CGSize {
    get {
        layer.shadowOffset
    }
    set {
         layer.shadowOffset = newValue
    }
}

@IBInspectable
public var shadowColor: UIColor {
    get {
        return UIColor(cgColor: layer.shadowColor ?? UIColor.clear.cgColor)
    }
    
    set {
        layer.shadowColor = newValue.cgColor
    }
}
Run Code Online (Sandbox Code Playgroud)

一切正常,但是当我调试视图时,我看到了一些像这样的紫色警告。 …

debugging xcode uiview swift

14
推荐指数
1
解决办法
5870
查看次数

标签 统计

debugging ×1

swift ×1

uiview ×1

xcode ×1