Challenge: NSBezierPath-based Hit Testing

The hit testing in this application is rather primitive. The user can click outside the rounded rect, but if they are still inside the rectangle, it will still register a hit.

Use NSBezierPath’s containsPoint(_:) method to make the hit testing completely accurate.

Get Cocoa Programming for OS X: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.