31

GitHub - IvanVorobei/RequestPermission: simple permission request with beautiful...

 5 years ago
source link: https://github.com/IvanVorobei/RequestPermission
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f666235336432306631353261336537366530353365366166353239333036363131666237393466302f7265736f75726365732f726571756573742d7065726d697373696f6e202d2062616e65722e737667

About

This project is about managing permissions with the customizable visual effects. Beautiful dialog increases the chance of approval (which is important when we request notification). Simple control of this module saves you hours of development. You can start using this project with just two lines of code and easy customization! You can see how I am designed UI on youtube

Preview GIF loading [4mb]. Please, wait

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f666235336432306631353261336537366530353365366166353239333036363131666237393466302f7265736f75726365732f726571756573742d7065726d697373696f6e202d206d6f636b75705f707265766965772e676966

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f366663643962646235306139396365613335383239343939396531363164666665353562653436662f7265736f75726365732f726571756573742d7065726d697373696f6e202d20646f6e6174652e737667

The project is absolutely free, but but it takes time to support and update it. Your support is very motivating and very important. I often receive emails asking me to update or add functionality. Small donate for a cup of coffee helps to develop the project and make it better

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f366663643962646235306139396365613335383239343939396531363164666665353562653436662f7265736f75726365732f726571756573742d7065726d697373696f6e202d20646f6e6174652e737667

Requirements

Swift 4.2. Ready for use on iOS 10+

Integration

Drop in Sparrow folder to your Xcode project. Make sure to enable Copy items if needed and Create groups

Or via CocoaPods:

pod 'SPRequestPermission'

How to use

Call SPRequestPermission and use func request(). Also passed controller, on which dialog should present

class ViewController: UIViewController {

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        SPPermission.Dialog.request(with: [.camera, .microphone, .notification], on: self)
    }
}

If you want to know if you have received permission, you should call the function:

let isAvailableCamera = SPPermission.isAllow(.сamera)

Available Permissions

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f393531343737633865383964653535656565616334343131303262353262313431356336393162372f7265736f75726365732f726571756573742d7065726d697373696f6e5f7065726d697373696f6e732e706e67

Delegate

To track events hide & allowed permission associated with SPPermission, implement the protocol SPPermissionDialogDelegate and pass the delegate

SPPermission.Dialog.request(
    with: [.calendar, .microphone],
    on: self,
    delegate: self
)

DataSource

If you want to change the text, you need to implement the SPPermissionDialogDataSource protocol. Redefine the needed parameters to see the changes. In the project you can find an example

SPPermission.Dialog.request(
    with: [.photoLibrary, .contacts],
    on: self,
    delegate: self,
    dataSource: self
)

if you want add or remove close button (for close dialog, need swipe it), you need ovveride parametr showCloseButton

68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f4976616e566f726f6265692f526571756573745065726d697373696f6e2f623365363133323935623733626533366338613364333531323664316637303135656634333261382f7265736f75726365732f726571756573742d7065726d697373696f6e202d20636c6f736520627574746f6e2e706e67

Apps, using lib

I like the idea to specify applications that use the RequestPermission. Please, contact me via email. You can find it in the section Contacts so that I added app here

License

RequestPermission is released under the MIT license. Check LICENSE.md for details

Contact

@ivanvorobei in telegram

https://hello.ivanvorobei.by

https://ivanvorobei.by

[email protected]

my apps in AppStore & in AppStore 2

If you need develop application or nice UI, write me


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK