<NME> README.md
<BEF> <p>
<a href="http://cocoadocs.org/docsets/Proposer"><img src="https://img.shields.io/cocoapods/v/Proposer.svg?style=flat"></a>
<a href="https://github.com/Carthage/Carthage/"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat"></a>
</p>

# Proposer

Proposer provides a single API to request permission for access **Camera**, **Photos**, **Microphone**, **Contacts** or **Location**.

## Requirements

Swift 2.0, iOS 8.0

(Project with Swift 1.2 can still use version 0.6.2)

## Example

Only one single API:

Only one single API:

```swift
proposeToAccess(_:agreed:rejected:)
```

In real world:

```swift
import Proposer
```

```swift
@IBAction func choosePhoto() {
    let photos: PrivateResource = .photos
    let propose: Propose = {
        proposeToAccess(photos, agreed: {
            print("I can access Photos. :]\n")
            if UIImagePickerController.isSourceTypeAvailable(.savedPhotosAlbum) {
                let imagePicker = UIImagePickerController()
                imagePicker.sourceType = .savedPhotosAlbum
                self.present(imagePicker, animated: true, completion: nil)
            }
        }, rejected: {
            self.alertNoPermissionToAccess(photos)
        })
    }
    showProposeMessageIfNeedFor(photos, andTryPropose: propose)
}
```

When you want to get user's location, thanks to Swift's enum, you can even choose the usage mode:

```swift
@IBAction func shareLocation() {
    let location: PrivateResource = .location(.whenInUse)
    let propose: Propose = {
        proposeToAccess(location, agreed: {
            print("I can access Location. :]\n")
        }, rejected: {
            self.alertNoPermissionToAccess(location)
        })
    }
    showProposeMessageIfNeedFor(location, andTryPropose: propose)
}
```

Depending on your needs, you must add a `NSLocationWhenInUseUsageDescription` or `NSLocationAlwaysUsageDescription` to your Info.plist

See the demo for more information.

I recommend you add a `UIViewController+Proposer.swift` file (like the demo) for show localized alert before the first proposal or when propose failed.

## Installation

Feel free to drag `Proposer.swift` to your iOS Project. But it's recommended to use Carthage (or CocoaPods).

### Carthage

```ogdl
github "nixzhu/Proposer"
```

#### CocoaPods

```ruby
pod 'Proposer'
```

platform :ios, '8.0'
use_frameworks!

pod 'Proposer', '~> 0.7.1'
```

Then, run the following command:
To integrate Proposer into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "nixzhu/Proposer" >= 0.7.1
```

Then, run the following command to build the Proposer framework:

<MSG> update version 0.8.0

<DFF> @@ -5,14 +5,12 @@
 
 # Proposer
 
-Proposer provides a single API to request permission for access **Camera**, **Photos**, **Microphone**, **Contacts** or **Location**.
+Proposer provides a single API to request permission for access **Camera**, **Photos**, **Microphone**, **Contacts**, **Reminders**, **Calendar** or **Location**.
 
 ## Requirements
 
 Swift 2.0, iOS 8.0
 
-(Project with Swift 1.2 can still use version 0.6.2)
-
 ## Example
 
 Only one single API:
@@ -89,7 +87,7 @@ source 'https://github.com/CocoaPods/Specs.git'
 platform :ios, '8.0'
 use_frameworks!
 
-pod 'Proposer', '~> 0.7.1'
+pod 'Proposer', '~> 0.8.0'
 ```
 
 Then, run the following command:
@@ -114,7 +112,7 @@ $ brew install carthage
 To integrate Proposer into your Xcode project using Carthage, specify it in your `Cartfile`:
 
 ```ogdl
-github "nixzhu/Proposer" >= 0.7.1
+github "nixzhu/Proposer" >= 0.8.0
 ```
 
 Then, run the following command to build the Proposer framework:

{'addition_count': 3, 'commit_subject': 'update version 0.8.0', 'deletion_count': 5, 'file_extension': '.md', 'lang': 'md', 'license': 'mit', 'repo_name': 'nixzhu/Proposer'}