How to set window level in Swift

I'm having problems with window level constants like NSScreenSaverWindowLevel . Swift complains about an unresolved identifier. I also could not find the equivalent equivalent of these levels? Is this currently possible?

I am trying to use:

 window.level = NSScreenSaverWindowLevel // unresolved identifier 
+2
source share
1 answer

Following the definition chain:

 #define NSScreenSaverWindowLevel kCGScreenSaverWindowLevel 

and...

 #define kCGScreenSaverWindowLevel CGWindowLevelForKey(kCGScreenSaverWindowLevelKey) /* 1000 */ 

I think the corrected answer is:

 window.level = Int(CGWindowLevelForKey(Int32(kCGScreenSaverWindowLevelKey))) 

a lot of casting due to inconsistencies in the listing types

+7
source

Source: https://habr.com/ru/post/980365/


All Articles