PKCCheck 0.1.3

PKCCheck 0.1.3

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2017年1月
SwiftSwift 版本3.0
SPM支持 SPM

维护者:pikachu987.



PKCCheck 0.1.3

  • pikachu987

PKCCheck

示例

要运行示例项目,请克隆仓库,并首先从 Example 目录运行 pod install



  • 导入 PKCCheck 头文件
import PKCCheck



  • ViewController
import PKCCheck

class ViewController: UIViewController{
  let pkcCheck = PKCCheck()
  override func viewDidLoad() {
        super.viewDidLoad()
        self.pkcCheck.delegate = self
    }
}



  • AudioAccessCheck
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()
    }
}



  • CameraAccessCheck
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()
    }
}



  • PhotoAccessCheck
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()
    }
}



  • PlugCheck
pkcCheck.plugAccessCheck()

extension ViewController: PKCCheckDelegate{
    func pkcCheckPlugIn() {
        print("plugIn")
    }

    func pkcCeckPlugOut() {
        print("plugOut")
    }
}



  • DecibelCheck
//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)")
    }
}



  • PermissionsChange
pkcCheck.permissionsChange()



  • Delegate All
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 文件。