[ASCornerLayoutSpec] New layout spec class for declarative corner element layout. (#657)

* Add new layout spec class with snapshot testing. Update examples and CHANGELOG.md

* Code review updates.

* Open curly bracket in a new line.
This commit is contained in:
huang-kun
2017-11-24 21:45:59 +08:00
committed by Huy Nguyen
parent b2539d3531
commit e4b2c05c21
42 changed files with 910 additions and 16 deletions

View File

@@ -74,7 +74,21 @@ extension UIImage {
return roundedImage ?? self
}
class func draw(size: CGSize, fillColor: UIColor, shapeClosure: () -> UIBezierPath) -> UIImage {
UIGraphicsBeginImageContext(size)
let path = shapeClosure()
path.addClip()
fillColor.setFill()
path.fill()
let image = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return image!
}
}
extension NSAttributedString {