Skip to content

Instantly share code, notes, and snippets.

@freysie
Created September 19, 2015 20:03
Show Gist options
  • Save freysie/d58dbd966548cb1d7059 to your computer and use it in GitHub Desktop.
Save freysie/d58dbd966548cb1d7059 to your computer and use it in GitHub Desktop.
class Window {
let element: AXUIElementRef
init?(processID: pid_t) {
element = AXUIElementCreateApplication(processID).takeRetainedValue()
}
var processID: pid_t {
let pointer = UnsafeMutablePointer<pid_t>.alloc(1)
AXUIElementGetPid(element, pointer)
let value = pointer.memory
pointer.dealloc(1)
return value
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment