Contents

devliusir/lcappsandboxfilekit

> [中文](README_CN.md) | [English](README.md)

How to use

  • Define the path for which authorization is required
let authorizedDirectory = "/"
  • Clear the access permissions of the specified path
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.")
    }
}
  • Clear access permissions for all paths
LCAppSandboxFileKit.standard.clearAllBookmarkData()
  • Check if the directory has access permissions
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.")
        }
    }
}
  • Request access permissions for the specified path,Customize panel information
LCAppSandboxFileKit.standard.requestAccessForPath("/", title: "custom title", panelButtonTitle: "button title", canChooseDirectories: true) { status in
     if status {
        print("Permission granted, proceeding with the process.")
    } else {
        print("Failed to obtain permission.")
    }
}
  • Request access to the specified path and whether to display the attachment view
 LCAppSandboxFileKit.standard.requestAccessForPath("/Users", isRootOptionEnabled: true, canChooseDirectories: true) { status in
     if status {
        print("Permission granted, proceeding with the process.")
    } else {
        print("Failed to obtain permission.")
    }
}

Design

| | | :------------: | | Accessory panel |

| | | :------------: | | Normal |

Installation

CocoaPods

PermissionsKit is available through CocoaPods. To install it, simply add the following line to your Podfile:


pod 'LCAppSandboxFileKit'

SwiftPackage

Add https://github.com/DevLiuSir/LCAppSandboxFileKit.git in the “Swift Package Manager” tab in Xcode.

License

MIT License

Copyright (c) 2024 Marvin

Author

| <img src="https://avatars2.githubusercontent.com/u/11488337?s=460&v=4" width="120px;"/> | DevLiuSir<br/><br/><sub>Software Engineer</sub><br/> [<img align="center" src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/twitter.svg" height="20" width="20"/>][1] [<img align="center" src="https://cdn.jsdelivr.net/npm/simple-icons@3.0.1/icons/github.svg" height="20" width="20"/>][2] [<img align="center" src="https://raw.githubusercontent.com/iconic/open-iconic/master/svg/globe.svg" height="20" width="20"/>][3]| | :------------: | :------------: |

[1]: https://twitter.com/LiuChuan_ [2]: https://github.com/DevLiuSir [3]: https://devliusir.com/

Package Metadata

Repository: devliusir/lcappsandboxfilekit

Default branch: main

README: README.md