Commit b90ee8ac by Daniel Dahan

cleanup for colors and layer shape setting

parent d89a6935
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
......
......@@ -259,20 +259,22 @@ extension CALayer {
return
}
if 0 == bounds.width {
bounds.size.width = bounds.height
if 0 == frame.width {
frame.size.width = frame.height
}
if 0 == bounds.height {
bounds.size.height = bounds.width
if 0 == frame.height {
frame.size.height = frame.width
}
guard .circle == shapePreset else {
masksToBounds = false
cornerRadius = 0
return
}
cornerRadius = bounds.size.width / 2
masksToBounds = true
cornerRadius = frame.size.width / 2
}
/// Sets the shadow path.
......
......@@ -44,7 +44,11 @@ public extension UIColor {
let r = argb >> 16
let g = argb >> 8
let b = argb >> 0
func f(_ v: UInt32) -> CGFloat { return CGFloat(v & 0xff) / 255 }
func f(_ v: UInt32) -> CGFloat {
return CGFloat(v & 0xff) / 255
}
self.init(red: f(r), green: f(g), blue: f(b), alpha: f(a))
}
......@@ -55,6 +59,6 @@ public extension UIColor {
- Parameter rgb: An unsigned 32 bit integer. E.g 0xAA44CC.
*/
convenience init(rgb: UInt32) {
self.init(argb: (UInt32(0xff000000)) | rgb)
self.init(argb: (0xff000000 as UInt32) | rgb)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment