Last active
June 28, 2020 11:09
-
-
Save TarasShu/4d9a8d6044a216db2a1b161efbe4c4cb to your computer and use it in GitHub Desktop.
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
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