Instance Method

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 was successful, otherwise false.

Discussion

Currently, NSApplicationActivationPolicyNone and NSApplicationActivationPolicyAccessory may be changed to NSApplicationActivationPolicyRegular, but other modifications aren’t supported.

See Also

Configuring the Activation Policy

func activationPolicy() -> NSApplication.ActivationPolicy

Returns the app’s activation policy.

enum NSApplication.ActivationPolicy

Activation policies (used by activationPolicy) that control whether and how an app may be activated.