Nathanael Carper
Nathanael Carper

Reputation: 312

Disable App Nap

I really need to disable App Nap in my OS X application in Swift but I've looked all over the web and can't find an answer. Any help would be appreciated.

Upvotes: 2

Views: 610

Answers (1)

Rashwan L
Rashwan L

Reputation: 38833

Try this:

let myQueue = OperationQueue()
    let myActivity = ProcessInfo.processInfo.beginActivity(
        options: ProcessInfo.ActivityOptions.userInitiated,
        reason: "Batch processing files")
    myQueue.addOperation(
        {
            // Perform batch processing of files here
            ProcessInfo.processInfo.endActivity(myActivity)
        }
    )

Read more about App Nap on Apples reference site here.

Upvotes: 2

Related Questions