Documentation
¶
Overview ¶
Package executionpolicy provides a fluent Go API over the macOS ExecutionPolicy framework.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EPErrorDomain ¶ added in v0.8.0
EPErrorDomain returns the string constant EPErrorDomain as an objc.ID, for use as a dictionary key or selector argument.
Types ¶
type DeveloperTool ¶
type DeveloperTool struct {
// contains filtered or unexported fields
}
DeveloperTool wraps raw.EPDeveloperTool with a fluent Go API.
func DeveloperToolFromID ¶
func DeveloperToolFromID(id objc.ID) *DeveloperTool
DeveloperToolFromID adopts an existing object pointer as a DeveloperTool (nil for 0).
func NewDeveloperTool ¶
func NewDeveloperTool() *DeveloperTool
NewDeveloperTool creates a new DeveloperTool.
func (*DeveloperTool) AuthorizationStatus ¶
func (x *DeveloperTool) AuthorizationStatus() EPDeveloperToolStatus
The current authorization status of the current process. - Returns: An EPDeveloperToolStatus indicating whether the current process has developer tool privileges.
AuthorizationStatus calls the underlying AuthorizationStatus.
func (*DeveloperTool) ID ¶
func (x *DeveloperTool) ID() objc.ID
ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.
func (*DeveloperTool) RequestDeveloperToolAccessWithCompletionHandler ¶
func (x *DeveloperTool) RequestDeveloperToolAccessWithCompletionHandler(handler func(bool))
Checks whether developer tool privileges are already available and if not populates an entry in Settings for user approval. This method does not show any UI to the user or guide them towards Settings for approval, if necessary. - Parameter handler: A block called asynchronously with whether the privilege is available. > New info > Concurrency Note: You can call this method from synchronous code using a completion handler, > as shown on this page, or you can call it as an asynchronous method that has the > following declaration: > > ```swift > func requestAccess() async -> Bool > ``` > > For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/swift/calling-objective-c-apis-asynchronously>.
RequestDeveloperToolAccessWithCompletionHandler calls the underlying RequestDeveloperToolAccessWithCompletionHandler.
func (*DeveloperTool) Unwrap ¶
func (x *DeveloperTool) Unwrap() *raw.EPDeveloperTool
Unwrap returns the underlying raw.EPDeveloperTool.
type DeveloperToolable ¶
type DeveloperToolable interface {
Unwrap() *raw.EPDeveloperTool
RequestDeveloperToolAccessWithCompletionHandler(handler func(bool))
AuthorizationStatus() EPDeveloperToolStatus
}
DeveloperToolable is the interface implemented by DeveloperTool, for mocking and DI.
type EPDeveloperToolStatus ¶ added in v0.5.0
type EPDeveloperToolStatus int64
const ( EPDeveloperToolStatusNotDetermined EPDeveloperToolStatus = 0 EPDeveloperToolStatusRestricted EPDeveloperToolStatus = 1 EPDeveloperToolStatusDenied EPDeveloperToolStatus = 2 EPDeveloperToolStatusAuthorized EPDeveloperToolStatus = 3 )
func (EPDeveloperToolStatus) String ¶ added in v0.5.0
func (e EPDeveloperToolStatus) String() string
type ExecutionPolicy ¶
type ExecutionPolicy struct {
// contains filtered or unexported fields
}
ExecutionPolicy wraps raw.EPExecutionPolicy with a fluent Go API.
func ExecutionPolicyFromID ¶
func ExecutionPolicyFromID(id objc.ID) *ExecutionPolicy
ExecutionPolicyFromID adopts an existing object pointer as a ExecutionPolicy (nil for 0).
func NewExecutionPolicy ¶
func NewExecutionPolicy() *ExecutionPolicy
NewExecutionPolicy creates a new ExecutionPolicy.
func (*ExecutionPolicy) AddPolicyExceptionForURLError ¶
func (x *ExecutionPolicy) AddPolicyExceptionForURLError(url string) (bool, error)
AddPolicyExceptionForURLError calls the underlying AddPolicyExceptionForURLError.
func (*ExecutionPolicy) ID ¶
func (x *ExecutionPolicy) ID() objc.ID
ID returns the underlying Objective-C object pointer (objc.ID), for passing to C APIs that take an object or CFTypeRef pointer.
func (*ExecutionPolicy) Unwrap ¶
func (x *ExecutionPolicy) Unwrap() *raw.EPExecutionPolicy
Unwrap returns the underlying raw.EPExecutionPolicy.
type ExecutionPolicyable ¶
type ExecutionPolicyable interface {
Unwrap() *raw.EPExecutionPolicy
AddPolicyExceptionForURLError(url string) (bool, error)
}
ExecutionPolicyable is the interface implemented by ExecutionPolicy, for mocking and DI.