Working with my app, i encountered some issues with drawing stuff:
I was wondering why, back to Obj-c, -moveToPoint()
and -lineToPoint()
were drawing everything with no problem and now, with swift, everything seems the same except for a strange border appearing on my view. Let me explain better:
Imagine that your task is to draw a basic line from A(0,0) to B(10,10)
We all know how to make that in obj-c, but in swift there is something new to me:
var path : NSBezierPath = NSBezierPath(rect: dirtyRect)
let color = NSColor(red: 0.0, green: 0.0, blue: 0.0, alpha: 1.0)
color.set()
path.moveToPoint(NSPoint(x: 0,y: 0))
path.lineToPoint(NSPoint(x: 10,y: 10))
path.lineWidth = 5.0 //Makes the line 5px width, but it even
//creates an annoying border along the view
//Try it out, i can't figure out how to get rid of it
path.stroke()