How to ignore my app's window on screenshot? (Swift 2.0)
问题 I wanted to get an image of the screen, ignoring my app's window. Found a code example in Objective-C and tried to convert it to Swift. Objective-C snipped: // Get onscreen windows CGWindowID windowIDToExcude = (CGWindowID)[myNSWindow windowNumber]; CFArrayRef onScreenWindows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID); CFMutableArrayRef finalList = CFArrayCreateMutableCopy(NULL, 0, onScreenWindows); for (long i = CFArrayGetCount(finalList) - 1; i >= 0; i--) {