https://github.com/devliusir/lcappsandboxfilekit
LCAppSandboxFileKit is a function to write and access files outside of the macOS application sandbox file! (LCAppSandboxFileKit 是一个用于写入和访问 macOS 应用程序沙盒文件之外的文件的功能的框架 ! )
https://github.com/devliusir/lcappsandboxfilekit
cocoapods macos nsopenpanel swift swift-package-manager
Last synced: about 1 year ago
JSON representation
LCAppSandboxFileKit is a function to write and access files outside of the macOS application sandbox file! (LCAppSandboxFileKit 是一个用于写入和访问 macOS 应用程序沙盒文件之外的文件的功能的框架 ! )
- Host: GitHub
- URL: https://github.com/devliusir/lcappsandboxfilekit
- Owner: DevLiuSir
- License: mit
- Created: 2024-12-18T02:14:01.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-02T16:47:17.000Z (about 1 year ago)
- Last Synced: 2025-04-02T17:03:31.101Z (about 1 year ago)
- Topics: cocoapods, macos, nsopenpanel, swift, swift-package-manager
- Language: Swift
- Homepage:
- Size: 478 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

LCAppSandboxFileKit is a framework for writing and accessing files outside of the macOS application sandbox file!
> [中文](README_CN.md) | [English](README.md)
## How to use
- Define the path for which authorization is required
```swift
let authorizedDirectory = "/"
```
- Clear the access permissions of the specified path
```swift
LCAppSandboxFileKit.standard.clearAccessForPath(authorizedDirectory) { status in
if status {
print("Successfully cleared access to the root directory.")
} else {
print("Failed to clear access to the root directory.")
}
}
```
- Check if the directory has access permissions
```swift
let isPermiss = LCAppSandboxFileKit.standard.checkAccessForPath(authorizedDirectory)
if isPermiss {
print("Directory access granted, starting search.")
} else { // No access, request permission
print("No directory access, requesting permission.")
LCAppSandboxFileKit.standard.requestAccessForPath(authorizedDirectory, canChooseDirectories: true) { status in
if status {
print("Permission granted, proceeding with the process.")
} else {
print("Failed to obtain permission.")
}
}
}
```
### Design
## Installation
### CocoaPods
PermissionsKit is available through [CocoaPods](https://cocoapods.org). To install it, simply add the following line to your Podfile:
```swift
pod 'LCAppSandboxFileKit'
```
### SwiftPackage
Add `https://github.com/DevLiuSir/LCAppSandboxFileKit.git` in the [“Swift Package Manager” tab in Xcode](https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app).
## License
MIT License
Copyright (c) 2024 Marvin
## Author
| [
](https://github.com/DevLiuSir) | [DevLiuSir](https://github.com/DevLiuSir)
Software Engineer
[
][1] [
][2] [
][3]|
| :------------: | :------------: |
[1]: https://twitter.com/LiuChuan_
[2]: https://github.com/DevLiuSir
[3]: https://devliusir.com/