I made an OS X Application in Xcode and I want to keep my Mac from going to sleep when I have it open. I know in iOS Swift you use:
UIApplication.sharedAppli
If you are trying to prevent idle triggered sleep, IOCancelPowerCharge might work. But it won't work if something manually triggers the sleep