The check-permissions is a Swift-based command line application designed to scan Info.plist
files in a specified directory and report the permissions requested by each file. This tool is particularly useful for developers working with iOS projects, as it helps ensure that the necessary permissions are properly declared in the project directory.
- Recursive Scanning: Searches all subdirectories within the specified directory for
Info.plist
files. - Permission Detection: Identifies various permissions requested in
Info.plist
files, such as camera access, location services, and more. - User-Friendly Output: Provides a clear report of permissions for each
Info.plist
file found.
- macOS 12.0 or later
- Swift 5.9 or later
-
Clone the Repository:
git clone https://github.com/ezefranca/check-permissions.git cd check-permissions
-
Run the Installation Script:
chmod +x install.sh ./setup.sh
The installation script will compile the tool and install it to /usr/local/bin
, making it available globally as check-permissions
.
--path <path>
: Specify the path to the directory. This is a required argument.--output <file>
Specify the file to output the results to. (default is console output)--verbose
: Enable verbose output for more detailed information.--help
: Display the help message.
To scan a directory for Info.plist
files and report the permissions:
check-permissions-cli --path <directory-path-to-scan>
To output to a report log file:
check-permissions-cli --path <directory-path-to-scan> --output report
To enable verbose output:
check-permissions-cli --path <directory-path-to-scan> --verbose
To display the help message:
check-permissions-cli --help
🚀 Starting the scanning process...
📂 Scanning directory: /Users/yourusername/Developer/YourProject
Found 3 Info.plist files.
File: /Users/yourusername/Developer/YourProject/ModuleA/Info.plist
- NSCameraUsageDescription
- NSLocationWhenInUseUsageDescription
File: /Users/yourusername/Developer/YourProject/ModuleB/Info.plist
- NSMicrophoneUsageDescription
✅ Scanning process completed.
To use the PermissionScan package in your Swift project, add it as a dependency in your Package.swift
:
// swift-tools-version:5.4
import PackageDescription
let package = Package(
name: "YourProject",
platforms: [
.iOS(.v15),
.macOS(.v12),
.watchOS(.v9),
.tvOS(.v15),
.visionOS(.v1)
],
dependencies: [
.package(url: "https://github.com/ezefranca/check-permissions", from: "0.0.4"),
],
targets: [
.target(
name: "YourProject",
dependencies: ["check-permissions-package"]),
]
)
Then import and use it in your code:
import check_permissions
let checker = PermissionChecker()
let report = checker.generateReport(for: URL(fileURLWithPath: "/path/to/your/project"))
for (plistPath, permissions) in report {
print("File: \(plistPath)")
for permission in permissions {
print(" - \(permission)")
}
}
We welcome contributions to enhance the functionality of this tool. Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Submit a pull request with a clear description of your changes.
This project is licensed under the MIT License.