An open API service indexing awesome lists of open source software.

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 应用程序沙盒文件之外的文件的功能的框架 ! )

Awesome Lists containing this project

README

          


 LCAppSandboxFileKit is a framework for writing and accessing files outside of the macOS application sandbox file!



Swift Versions


Supported Platforms















> [中文](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/