swift优雅请求权限

swift优雅请求权限_第1张图片
Screen Shot 2017-10-17 at 11.22.18.png

https://github.com/IvanVorobei/RequestPermission


import UIKit

class ViewController: UIViewController {
    
    let permissins: [SPRequestPermissionType] = [.camera, .photoLibrary, .notification, .locationAlways]

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.init(hex: "#00A3E8")
        self.patternView.setRhombusPattern()
        self.patternView.color = UIColor.red
        self.patternView.alpha = 0.1
        self.patternView.cellWidthMax = 70
    }
    
    @IBAction func tapPresentAction(_ sender: Any) {
        //dialog.interactive
        SPRequestPermission.dialog.interactive.present(on: self, with: self.permissins)
        
        //native
        //SPRequestPermission.native.present(with: self.permissins)
    }
    
    //Mark: - Other
    @IBOutlet weak var patternView: SPPatternView!
    
    override var preferredStatusBarStyle: UIStatusBarStyle {
        return .lightContent
    }
}

你可能感兴趣的:(swift优雅请求权限)