This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// CGRectを拡大する | |
extension CGRect { | |
func enlarge(rate :CGFloat) -> CGRect { | |
if rate > 1 { | |
let distanceRate = (rate - 1) / 2 | |
let distanceX = -width * distanceRate | |
let distanceY = -height * distanceRate | |
return insetBy(dx: distanceX, dy: distanceY) | |
} | |
return self |