This is an example of how to create a triangle using CGPath, you only have to put the points.
var path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, 0, 0) //start from here
CGPathAddLineToPoint(path, nil, 20, 44)
CGPathAddLineToPoint(path, nil, 40, 0)
CGPathAddLineToPoint(path, nil, 0, 0)
//and to use in SpriteKit, for example
var tri = SKShapeNode(path: path)
var color = NSColor.blueColor()
tri.strokeColor = color
tri.fillColor = color
This is the result
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…