Skip to content

mayankk2308/privilege

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Easily request superuser privilege in macOS applications with a user-interactive and native password prompt.

Installation

Privilege only supports Swift Package Manager. Add it as a dependency in your project's Package.swift dependencies section as follows:

.package(name: "Privilege", url: "https://github.com/mayankk2308/privilege.git", from: "1.0.0")

Then add the package "Privilege" to your targets that require it.

Usage

First import the module:

import Privilege

To gain superuser permissions:

Privilege.escalate()
// Returns true if rights are extended successfully.

To de-escalate:

Privilege.deEscalate()
// Returns true if rights are dropped successfully.