Skip to content

Instantly share code, notes, and snippets.

@TarasShu
Last active June 28, 2020 11:09
Show Gist options
  • Save TarasShu/4d9a8d6044a216db2a1b161efbe4c4cb to your computer and use it in GitHub Desktop.
Save TarasShu/4d9a8d6044a216db2a1b161efbe4c4cb to your computer and use it in GitHub Desktop.
func makePlus(at point: CGPoint, dimension: CGFloat, thickness: CGFloat) -> [CGRect] {
let width = dimension
let height = thickness
let first = CGRect(
x: point.x - dimension / 2 ,
y: point.y - thickness / 2,
width: width,
height: height)
let second = CGRect(
x: point.x - thickness / 2,
y: point.y - dimension / 2,
width: height,
height: width)
return [first, second]
}
let point = CGPoint(x: 150.0, y: 150.0)
var plus = makePlus(at: point, dimension: 60.0, thickness: 30.0)
context.fill(plus)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment