I\'ve managed to get the display to sleep immediately with
pmset displaysleepnow
in terminal, however for waking the display I\'ve only found>
Here is the answer in Swift 3.x:
var assertionID : IOPMAssertionID = 0 _ = IOPMAssertionDeclareUserActivity("" as CFString, kIOPMUserActiveLocal, &assertionID)