Contents

setActivationPolicy(_:)

Attempts to modify the app’s activation policy.

Declaration

func setActivationPolicy(_ activationPolicy: NSApplication.ActivationPolicy) -> Bool

Parameters

  • activationPolicy:

    The desired activation policy.

Return Value

true if the policy switch succeded; otherwise, false.

Discussion

You can set any activation policy in macOS 10.9 and later; in macOS 10.8 and earlier, you can only set the activation policy to NSApplicationActivationPolicyProhibited or NSApplicationActivationPolicyRegular.

See Also

Configuring the activation policy