Instance Method


Locks the focus to the view atomically if the canDraw method returns true and returns the value of canDraw.


func lockFocusIfCanDraw() -> Bool


Your thread will not be preempted by other threads between the canDraw method and the lock. This method fails to lock focus and returns false, when the view is hidden and the current context is drawing to the screen (as opposed to a printing context).

See Also


func lockFocus()

Locks the focus on the view, so subsequent commands take effect in the view’s window and coordinate system.

func lockFocusIfCanDraw(in: NSGraphicsContext) -> Bool

Locks the focus to the view atomically if drawing can occur in the specified graphics context.

func unlockFocus()

Unlocks focus from the current view.

class var focusView: NSView?

Returns the currently focused NSView object, or nil if there is none.