测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2017年1月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
维护者:pikachu987.
要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install
。
import PKCCheck
import PKCCheck
class ViewController: UIViewController{
let pkcCheck = PKCCheck()
override func viewDidLoad() {
super.viewDidLoad()
self.pkcCheck.delegate = self
}
}
pkcCheck.audioAccessCheck()
extension ViewController: PKCCheckDelegate{
func pkcCheckAudioPermissionUndetermined() {
print("audioAccess: undetermined (first approach)")
}
func pkcCheckAudioPermissionGranted() {
print("audioAccess: granted")
}
func pkcCheckAudioPermissionDenied() {
print("audioAccess: denied")
self.pkcCheck.permissionsChange()
}
}
pkcCheck.cameraAccessCheck()
extension ViewController: PKCCheckDelegate{
func pkcCheckCameraPermissionUndetermined() {
print("cameraAccess: undetermined (first approach)")
}
func pkcCheckCameraPermissionGranted() {
print("cameraAccess: granted")
}
func pkcCheckCameraPermissionDenied() {
print("cameraAccess: denied")
self.pkcCheck.permissionsChange()
}
}
pkcCheck.photoAccessCheck()
extension ViewController: PKCCheckDelegate{
func pkcCheckPhotoPermissionUndetermined() {
print("photoAccess: undetermined (first approach)")
}
func pkcCheckPhotoPermissionGranted() {
print("photoAccess: granted")
}
func pkcCheckPhotoPermissionDenied() {
print("photoAccess: denied")
self.pkcCheck.permissionsChange()
}
}
pkcCheck.plugAccessCheck()
extension ViewController: PKCCheckDelegate{
func pkcCheckPlugIn() {
print("plugIn")
}
func pkcCeckPlugOut() {
print("plugOut")
}
}
//pkcCheck.minDecibelDegree = 45
//pkcCheck.maxDecibelDegree = 315
pkcCheck.decibelStart()
pkcCheck.decibelStop()
extension ViewController: PKCCheckDelegate{
func pkcCheckDecibel(_ level: CGFloat, average: CGFloat, degree: CGFloat, radian: CGFloat) {
}
func pkcCheckSoundErr(_ error: Error) {
print("sound error: \(error)")
}
}
pkcCheck.permissionsChange()
extension ViewController: PKCCheckDelegate{
func pkcCheckAudioPermissionUndetermined() {
print("audioAccess: undetermined (first approach)")
}
func pkcCheckAudioPermissionGranted() {
print("audioAccess: granted")
}
func pkcCheckAudioPermissionDenied() {
print("audioAccess: denied")
self.pkcCheck.permissionsChange()
}
func pkcCheckCameraPermissionUndetermined() {
print("cameraAccess: undetermined (first approach)")
}
func pkcCheckCameraPermissionGranted() {
print("cameraAccess: granted")
}
func pkcCheckCameraPermissionDenied() {
print("cameraAccess: denied")
self.pkcCheck.permissionsChange()
}
func pkcCheckPhotoPermissionUndetermined() {
print("photoAccess: undetermined (first approach)")
}
func pkcCheckPhotoPermissionGranted() {
print("photoAccess: granted")
}
func pkcCheckPhotoPermissionDenied() {
print("photoAccess: denied")
self.pkcCheck.permissionsChange()
}
func pkcCheckPlugIn() {
print("plugIn")
}
func pkcCeckPlugOut() {
print("plugOut")
}
func pkcCheckDecibel(_ level: CGFloat, average: CGFloat, degree: CGFloat, radian: CGFloat) {
}
func pkcCheckSoundErr(_ error: Error) {
print("sound error: \(error)")
}
}
PKCCheck 可通过 CocoaPods 获取。要安装它,只需将以下行添加到您的 Podfile 中
pod "PKCCheck"
pikachu987, [email protected]
PKCCheck 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。